| 关键词: lamp local mysql install usr with echo log apache php |
采用自动安装脚本安装lamp架构是个很舒服的事情!当然这里面和很多其他安装步骤一样会产生一些问题。以下shell脚本是转载来的,我更改了部分内容,以适应我的需求。mysql会有点儿问题,所以我还是用yum insyall mysql安装,此脚本里面没有chkconfig httpd的自启动,所以我添加了一下。 #!/bin/bash #version:2011-9-16 #create by roc #dis: this is used to auto install lamp. #rocbg lamp_down=/root/tarbag lamp_tar=/root/software lamp_log=/tmp/lamp_install.log echo "####################`date` #################" 》 $lamp_log ip=`ifconfig eth0 | grep Bcast | awk -F ":" '{print $2}' | cut -d " " -f 1` echo ip:$ip 》 $lamp_log if [ ! -d /root/tarbag ];then mkdir /root/tarbag fi #download lamp packet #wget http://labs.renren.com/apache-mirror//httpd/httpd-2.2.21.tar.gz -P $lamp_down #wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.6.tar.gz -P $lamp_down #wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz -P $lamp_down #wget http://ijg.org/files/jpegsrc.v8c.tar.gz -P $lamp_down #wget http://sourceforge.net/projects/libpng/files/libpng15/1.5.4/libpng-1.5.5.tar.gz/download -P $lamp_down #wget http://blog.s135.com/soft/linux/nginx_php/mysql/mysql-5.5.3-m3.tar.gz -P $lamp_down #wget http://cn2.php.net/distributions/php-5.3.8.tar.bz2 -P $lamp_down if [ ! -d /root/software ];then mkdir /root/software fi #uncompress file cd $lamp_down for i in $lamp_down/*.tar.gz do tar -xzvf $i -C $lamp_tar done for i in $lamp_down/*.tar.bz2 do tar -xjvf $i -C $lamp_tar done #Apache install echo "Apache install start!" 》$lamp_log cd $lamp_tar/httpd-2.2.21/ ./configure --prefix=/usr/local/apache2 --enable-so \ --enable-rewrite --enable-vhost-alias --enable-http \ --enable-static-htpasswd sleep 10 make && make install sleep 8 ln -s /usr/local/apache2/bin/apachectl /bin/apachectl #set autostart ln -s /usr/local/apache2/bin/apachectl /etc/init.d/httpd sed -i '2c\#chkconfig: 2345 70 30 #description: Apache is a World Web server. #processname: httpd ' /etc/init.d/httpd chkconfig --add httpd chkconfig --level 3 httpd chkconfig httpd on #modity ServerName DirectoryIndex options sed -i '292c\ServerName $ip:80' /usr/local/apache2/conf/httpd.conf sed -i '394c\DirectoryIndex index.php index.html index.html.var' /usr/local/apache2/conf/httpd.conf #test apache configure /bin/apachectl -t 》 $lamp_log echo "`date` Apache is Installed" 》 $lamp_log #sed -i '6c\SELINUX=disabled' /etc/selinux/config /bin/apachectl start && echo "`date` Apache is started Good!" 》 $lamp_log echo "`date` Please modify httpd.conf ServerName Option" 》 $lamp_log #Freetype Install echo "`date` Freetype install start" 》 $lamp_log cd $lamp_tar/freetype-2.4.6/ ./configure --prefix=/usr/local/freetype make && make install sleep 5 echo "`date` Freetype is installed" 》 $lamp_log sleep 10 #JPEG install echo "`date` jpeg install start" 》 $lamp_log cd $lamp_tar/jpeg-8 ./configure --prefix=/usr/local/jpeg7 make && make install echo "`date` jpeg is installed" 》 $lamp_log sleep 8 #libpng Install echo "`date` libpng install start" 》 $lamp_log cd $lamp_tar/libpng-1.5.5 ./configure --prefix=/usr/local/libpng make && make install echo "`date`libpng is installed" 》 $lamp_log sleep 10 #gd install echo "`date`gd start install" cd $lamp_tar/gd-2.0.33 ./configure --prefix=/usr/local/gd \ --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype \ --with-jpeg=/usr/local/jpeg7 #modify gd_png.c sed -i '/png.h/d' gd_png.c sed -i '15c\#include "/usr/local/libpng/include/png.h" ' gd_png.c make && make install echo "`date` gd is installed" 》 $lamp_log #Mysql Install #useradd mysql && echo "`date` user mysql added" 》 $lamp_log # #cd $lamp_tar/mysql-5.5.3-m3 #./configure --prefix=/usr/local/mysql --datadir=/mydata --with-charset=utf8 --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-ssl --with-embedded-server --enable-local-infile --enable-assembler --with-plugins=innobase --with-plugins=partition # #make && make install # #echo "`date` mysql is installed " 》 $lamp_log ##about configure file #cp $lamp_tar/mysql-5.5.3-m3 #cp support-files/my-large.cnf /etc/my.cnf #chown -R mysql.mysql /usr/local/mysql # ##pre databases #/usr/local/mysql/bin/mysql_install_db --user=mysql ##service file #cp $lamp_tar/mysql-5.5.3-m3/support-files/mysql.server /etc/init.d/mysql #chmod 755 /etc/init.d/mysql ##start mysql #/etc/init.d/mysql start && echo "`date` mysql service is ready" 》 $lamp_log #PHP install echo "`date` php-5.3.8 start install " 》 $lamp_log cd $lamp_tar/php-5.3.8 #./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local/jpeg7/ --with-gd=/usr/local/gd/ --with-png-dir=/usr/local/libpng/ --with-freetype-dir=/usr/local/freetype/ --enable-mbregex --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local/jpeg7/ --with-gd=/usr/local/gd/ --with-png-dir=/usr/local/libpng/ --with-freetype-dir=/usr/local/freetype/ --enable-mbregex --with-mysql=/usr/local/mysql/ --with-pdo-mysql=/usr/local/mysql/ make && make install #copy file and write to log #php.ini-recommended for php.ini-production cp $lamp_tar/php-5.3.8/php.ini-production /usr/local/php5/lib/php.ini && \ echo "`date` php.ini file is copyed to /usr/local/php5/lib/" 》 $lamp_log echo "application/x-httpd-php php" 》 /usr/local/apache2/conf/mime.types #edit test.php touch $htdocs/test.php cat 》 $htdocs/test.php 《 CHENG <? phpinfo(); ?> echo "Go to http://$ip/test.php" 》 $lamp_log echo "Mysql port 3306 and socket_file is /tmp/mysql.socket" 》 $lamp_log echo " user=root paswd=null" 》 $lamp_log echo "##########end################" 》 $lamp_log cat /usr/local/apache2/build/config.nice 》 $lamp_log /usr/local/php/bin/php -i |grep configure 》 $lamp_log cat /usr/local/mysql/bin/mysqlbug|grep configure 》 $lamp_log |
|
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系
[邮箱地址] 删除
|