Lamp Dynamic Website Build script

Source: Internet
Author: User
Tags mcrypt php server phpmyadmin

#!/bin/bash#auto make install lamp#by authors zhang 2016#httpd define  path variableh_files=httpd-2.2.17.tar.gzh_files_dir=httpd-2.2.17h_prefix=/usr/local/httpd/#mysql   define path variablem_files=mysql-5.5.22.tar.gzm_files_dir=mysql-5.5.22m_prefix=/usr/local/mysql/# php define path variablep_files1=libmcrypt-2.5.8.tar.gzp_files_dir1=libmcrypt-2.5.8p_prefix1=/ usr/local/lib/p_files2=mhash-0.9.9.9.tar.gzp_files_dir2=mhash-0.9.9.9p_prefix2=/usr/local/lib/p_files3= mcrypt-2.6.8.tar.gzp_files_dir3=mcrypt-2.6.8p_prefix3=/usr/local/lib/p_files4=php-5.3.28.tar.gzp_files_dir4= php-5.3.28p_prefix4=/usr/local/php/if [ -z  "$"  ];then         echo -e  "\033[36m Please select the following options: \033[0m"         echo  -e  "\033[32M1" Compile and install Apache server \033[1m "        echo " 2) Compile and install MySQL server "        echo  "3) Compile and install PHP server"         echo   "4) Configure index.php and start lamp service" echo  "5) Deploy phpMyAdmin system"         echo  -e  "\033[31m use:  { /bin/sh $0 1|2|3|4|help}\033[0m"          exitfi#auto install apacheif [ $1 -eq 1 ];then         rpm -e httpd --nodeps         tar -zxvf  $H _files &&cd  $H _files_dir ;. /configure --prefix= $H _prefix --enable-so --enable-rewrite --enable-charset-lite -- enable-cgi        if [ $? -eq 0 ];then                 make && Make install                echo -e  "\033[32mThe  $H _ files_dir server install successfully! (Apache service installation is complete!) ) \033[0m "        else                 echo -e  "\033[32mthe  $H _files_dir server  install failed,please check...\033[0m "                 exit        fifi#auto  install mysqlif [ $1 -eq 2 ];then         rpm -e mysql-server mysql --nodeps         tar -zxvf cmake-2.8.6.tar.gz -c /usr/src/ && cd /usr/src/ cmake-2.8.6/;. /configure        if&nBsp [ $? -eq 0 ];then                 gmake &&gmake install                 echo -e  "\033[32mthe cmake server  install successfully! (CMake compile installation complete!) \033[0m "        else                 echo -e   "\033[32mthe cmake server install failed,please check...\033[0m"                  exit         fi        useradd -M -u  27 -s /sbin/nologin mysql        cd /root         tar -zxvf  $M _files -c /usr/src/;cd /usr/src/$M _files_dir &&  cmake -dcmake_install_prefix= $M _prefix -dsysconfdir=/etc -ddefault_charset=utf8 - ddefault_collation=utf8_general_ci -dwith_extra_charsets=all         if [ $? -eq 0 ];then                 make &&make install                 echo -e  "\033[32mthe mysql   $M _files_dir install successfully! (MySQL service installation is complete!) ) \033[0m "        else                 echo -e  "\033[32mthe mysql  $M _files_dir  install failed,please check...\033[0m "                exit         fi        chown -r mysql:mysql /usr/ local/mysql/        cd /usr/src/$M _files_dir         cp support-files/my-medium.cnf /etc/my.cnf          $M _prefix/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/  --datadir=/usr/local/mysql/data/        cd /usr/src/$M _ files_dir        ln -s /usr/local/mysql/bin/* /usr/ local/bin/        cp support-files/mysql.server /etc/init.d/ mysqld        chmod +x /etc/rc.d/init.d/mysqld         chkconfig --add mysqld        chkconfig mysqld  on        service mysqld stop         service mysqld start        netstat - Anpt | grep 3306fi#php define path variableif [ $1 -eq 3  ];then        tar -zxvf  $P _files1 -c /usr/ src/;cd /usr/src/$P _files_dir1/ && ./configure && make & & make install && ln -s /$P _prefix1/libmcrypt.* /usr/lib/         cd /root/        tar  -zxvf  $P _files2 -c /usr/src/;cd /usr/src/$P _files_dir2/ && ./ Configure && make && make install && ln -s /$P _prefix2/libmhash*  /usr/lib/        cd /root/         tar -zxvf  $P _files3 -c /usr/src/;cd /usr/src/$P _files_dir3/ & & export ld_library_path=/$P _prefix3: $LD _library_path && ./configure  && make && make install        cd  /root/        tar -zxvf  $P _files4 -c /usr/ src/;cd /usr/src/$P _files_dir4/ && ./configure --prefix= $P _prefix4 -- with-mcrypt --with-apxs2= $H _prefix/bin/apxs --with-mysql= $M _prefix --with-config-file-path= $P _ prefix4 --enable-mbstring --enable-sockets        if [  $? -eq 0 ];then                make  &&make install                 echo -e  "\033[32mthe  $P _files_dir4 server install successfully ! (PHP installation is complete!) ) \033[0m "        else                 echo -e  "\033[32mthe  $P _files_dir4 server  install failed,please check...\033[0m "                 exit        fifiif [  $1 -eq 4 ];then        sed -i  '/ Directoryindex/s/index.html/index.php index.html/g '   $H _prefix/conf/httpd.conf         echo  "addtype   application/x-httpd-php .php"  >> $H _prefix/conf/ httpd.conf        ip= ' ifconfig eth0|grep  ' Bcast ' |awk  ' { print $2} ' |cut -d: -f2 '         echo  ' You can  access http://$IP/"cat > $H _prefix/htdocs/index.php <<eof<?phpphpinfo ();? >eoffiif [ $1 -eq 5 ];then        tar  -zxvf phpMyAdmin-4.2.5-all-languages.tar.gz        mv  phpmyadmin-4.2.5-all-languages/ /usr/local/httpd/htdocs/phpmyadmin         cd /usr/local/httpd/htdocs/phpMyAdmin        cp  Config.sample.inc.php config.inc.php        if [ $?  -eq 0 ];then                echo -e  " \033[32mphpmyadmin system installation is complete! \033[0m "        else                 echo -e  "\033[31mphpmyadmin system installation Failed! \033[0m "        fifi      #   netstat -tnl       # /usr/local/httpd/bin/apachectl -t         #/usr/local/httpd/bin/apachectl start          #ps  -ef | grep http          #       echo -e  "\033[32m configuration complete, open browser test results \033[0m" # PhpMyAdmin Test:fireorx http://192.168.1.1/phpmyadmin &

This article from the "Speed of Light Snail" blog, reproduced please contact the author!

Lamp Dynamic Website Build script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.