模块化的安装lnmp脚本推荐

最近公司的项目很多,研发那里需要的测试环境很多,而且基本都是lnmp的测试环境(也有apache与tomcat,但非常少),测试没有问题之后还需要上线,所以最近我很忙,而且都是重复性的工作,本来我用虚拟机安装一个lnmp的环境,但研发说必须用真实机器进行测试,所以为了偷懒,我只能用lnmp的自动安装脚本了,刚开始使用还可以,但很多的脚本里都不能设置安装路径、软件也是老版本的,所以我又根据我自己的实际需要编写了一份模块化的安装lnmp脚本。

此脚本可以需要单独的安装mysql、nginx、php,还可以选择自动的安装lnmp,并且安装的目录都可以自己设定,很简单与智能化,其中我编写脚本的时候,参考了linuxeye的 LNMP源码安装脚本(http://linuxeye.blog.51cto.com/4371937/773362),也参考了张宴的博客(http://blog.s135.com/nginx_php_v6)。感谢他们的分享精神。

本脚本我已经在rhel 5.4 32与64位系统都进行了测试,没有发现问题,并且我在生产环境里也使用了这个脚本,也没有发现问题。

一、准备工作

脚本最新的下载地址为http://pan.baidu.com/share/link?shareid=97808 uk=3892479934

1、把install_lnmp.tar.gz上传的到服务器(我传输的目录是tmp)

[root@localhosttmp]#tarzxfinstall_lnmp.tar.gz

查看install_lnmp.sh与soft是否解压

[root@localhosttmp]#ll total64480 -rwxr-xr-x1rootroot13726Mar2502:17install_lnmp.sh -rw-r--r--1rootroot65911213Mar2502:17install_lnmp.tar.gz srwxr-xr-x1rootroot0Mar2314:19mapping-root drwxr-xr-x5rootroot4096Mar2311:54soft drwx------2rootroot4096Mar2314:19ssh-IMPTGZ3620 

运行install_lnmp.sh

[root@localhosttmp]#shinstall_lnmp.sh Usage:install_lnmp.sh{install_yum|init|install_mysql|install_nginx|install_php|install_lnmp|install_check} 

从输出可以看出,可以使用install_yum、init、install_mysql等命令进行,下面介绍这些命令的含义install_yum 如果本机的yum不能使用的时候,可以使用此命令init进行安装所需的库install_mysql 进行mysql的安装install_nginx进行nginx的安装install_php进行php的安装install_lnmp 进行nginx、mysql、php与所需库文件的安装install_check 进行检查是否安装nginx、mysql、php,并输出安装目录现在我们先进行检查本机是否安装了nginx、mysql、php,这里使用install_check

[root@localhosttmp]#shinstall_lnmp.shinstall_check SunMar2502:26:32EDT2012Startinstall! ==========================Checkinstall================================ Error:/usr/local/nginxnotfound!!! Error:/usr/local/phpnotfound!!! Error:/usr/local/mysqlnotfound!!! ==========================Checkinstall================================ Sorry,FailedtoinstallLNMP! Pleasecheckerrorsandlogs. SunMar2502:26:32EDT2012Finishinstall! Totalruntime:0Seconds 

从输出可以看出,nginx、mysql、php都没有安装在进行安装的时候,可以使用nohup来进行后台的安装,并且还有nohup.out目录可以查看安装的情况二、脚本介绍1、下载方法

wgethttp://202.96.42.117/soft/install_lnmp.tar.gz tarzxfinstall_lnmp.tar.gz 

如果上面的下载地址不好使,可以使用以下的地址:http://pan.baidu.com/share/link?shareid=97808 uk=3892479934

2、脚本中软件的版本信息

cmake-2.8.4.tar.gz mysql-5.5.10.tar.gz libiconv-1.13.1.tar.gz libmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz mcrypt-2.6.8.tar.gz php-5.3.10.tar.gz memcache-2.2.5.tgz eaccelerator-0.9.6.1.tar.bz2 PDO_MYSQL-1.0.2.tgz ImageMagick-6.6.7-10.tar.gz imagick-2.3.0.tgz pcre-8.12.tar.gz nginx-1.0.12.tar.gz ngx_cache_purge-1.3.tar.gz 

3、脚本介绍

#!/bin/bash #author dl528888#blog http://dl528888.blog.51cto.comLANG=Cinstallhere= /data/software  #脚本与软件包存放的地方nginx_dir= /usr/local/nginx  #nginx的安装目录php_dir= /usr/local/php  #php的安装目录mysql_dir= /usr/local/mysql  #mysql的安装目录mysql_datadir= /data/mysql/data #mysql的数据存放目录mysql_logdir= /data/mysql  #mysql的日志目录mysql_passwd= admin  #mysql的登陆密码#Checkifuserisroot  #脚本需要在root用户下运行,所以先进行用户监测if[$(id-u)!= 0 ];then echo Error:Youmustberoottorunthisscript,pleaseuseroottoinstallsoft exit1 fi #DisableSeLinux  #关闭selinuxif[-s/etc/selinux/config];then sed-i's/SELINUX=enforcing/SELINUX=disabled/g'/etc/selinux/config fi if[!-d $installhere ];then #如果脚本存放的目录不存在,就自动的创建mkdir-p$installhere fi if[!-d $installhere/soft ];then #如果脚本不在那个存放的目录里,则复制过去cp-asoft$installhere fi #setupruntime  #进行运行时间的统计 functionstart_time() { start_time= $(date+%s) echo $(date)Startinstall! echo $start_time  /tmp/Install_lnmp_runtime } functionend_time() { end_time= $(date+%s) total_s=$(($end_time-$start_time)) total_m=$(($total_s/60)) if[$total_s-lt60];then time_en= ${total_s}Seconds else time_en= ${total_m}Minutes fi echo $(date)Finishinstall! echo Install_lnmp.shruntime:${time_en} /tmp/Install_lnmp_runtime echo Totalruntime:${time_en} } #ifyumfail,pleaseuseinstall_yumtosolve. 如果yum不可用,可以使用此模块来进行安装yumfunctioninstall_yum() { wgethttp://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm wgethttp://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt rpm-Uvhrpmforge-release-0.5.1-1.el5.rf.i386.rpm rpm--importRPM-GPG-KEY.dag.txt yum-yinstallyum-fastestmirroryum-presto } #initsetupLibrary 安装lnmp需要的库functioninit() { yum-yinstallyum-fastestmirroryum-presto yum-yinstallgccgcc-c++autoconflibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-devellibxml2libxml2-develzlibzlib-develglibcglibc-develglib2glib2-develbzip2bzip2-develncursesncurses-develcurlcurl-devele2fsprogse2fsprogs-develkrb5-devellibidnlibidn-developensslopenssl-develnss_ldapopenldapopenldap-developenldap-clientsopenldap-serverslibxslt-devellibevent-develntplibtool-ltdlbisonlibtoolvim-enhanced } #installmysql 安装mysql的模块functioninstall_mysql() { cd$installhere/soft/mysql/ useradd-M-s/sbin/nologinmysql mkdir-p$mysql_datadir; chownmysql.mysql-R$mysql_datadir tarxzfcmake-2.8.4.tar.gz cdcmake-2.8.4 ./configure make makeinstall cd.. tarzxfmysql-5.5.10.tar.gz cdmysql-5.5.10 cmake.-DCMAKE_INSTALL_PREFIX=$mysql_dir/\ -DMYSQL_DATADIR=$mysql_datadir\ -DMYSQL_UNIX_ADDR=$mysql_logdir/mysqld.sock\ -DWITH_INNOBASE_STORAGE_ENGINE=1\ -DENABLED_LOCAL_INFILE=1\ -DMYSQL_TCP_PORT=3306\ -DCMAKE_THREAD_PREFER_PTHREAD=1\ -DEXTRA_CHARSETS=all\ -DDEFAULT_CHARSET=utf8\ -DDEFAULT_COLLATION=utf8_general_ci\ -DMYSQL_UNIX_ADDR=$mysql_logdir/mysql.sock\ -DWITH_DEBUG=0make makeinstall rm-rf/etc/my.cnf rm-rf/etc/init.d/mysqld mkdir$mysql_logdir/relaylog mkdir$mysql_logdir/binlog cp$installhere/soft/mysql/my.cnf/etc/my.cnf cpsupport-files/mysql.server/etc/init.d/mysqld chmod755/etc/init.d/mysqld chkconfig--addmysqld chkconfigmysqldon chownmysql.mysql-R$mysql_logdir chownmysql.mysql-R$mysql_datadir $mysql_dir/scripts/mysql_install_db--user=mysql--basedir=$mysql_dir--datadir=$mysql_datadir /sbin/servicemysqldstart echo'exportPATH=$PATH:'$mysql_dir'/bin' /etc/profile $mysql_dir/bin/mysql-e grantallprivilegeson*.*toroot@'%'identifiedby'$mysql_passwd'withgrantoption; $mysql_dir/bin/mysql-e flushprivileges; $mysql_dir/bin/mysql-e deletefrommysql.userwherepassword=''; source/etc/profile /sbin/servicemysqldrestart echo mysqlinstallsuccess! } #installphp 安装php的模块functioninstall_php() { cd$installhere/soft/php tarxzflibiconv-1.13.1.tar.gz cdlibiconv-1.13.1 ./configure--prefix=/usr/local make makeinstall cd../ tarxzflibmcrypt-2.5.8.tar.gz cdlibmcrypt-2.5.8 ./configure make makeinstall /sbin/ldconfig cdlibltdl/ ./configure--enable-ltdl-install make makeinstall cd../../ tarxzfmhash-0.9.9.9.tar.gz cdmhash-0.9.9.9 ./configure make makeinstall cd../ if[-e /lib64 ];then ln-s/usr/local/lib/libmcrypt.la/usr/lib64/libmcrypt.la ln-s/usr/local/lib/libmcrypt.so/usr/lib64/libmcrypt.so ln-s/usr/local/lib/libmcrypt.so.4/usr/lib64/libmcrypt.so.4 ln-s/usr/local/lib/libmcrypt.so.4.4.8/usr/lib64/libmcrypt.so.4.4.8 ln-s/usr/local/lib/libmhash.a/usr/lib64/libmhash.a ln-s/usr/local/lib/libmhash.la/usr/lib64/libmhash.la ln-s/usr/local/lib/libmhash.so/usr/lib64/libmhash.so ln-s/usr/local/lib/libmhash.so.2/usr/lib64/libmhash.so.2 ln-s/usr/local/lib/libmhash.so.2.0.1/usr/lib64/libmhash.so.2.0.1 ln-s/usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-config ln-s/usr/local/mysql/lib/libmysqlclient.so.18/lib64/libmysqlclient.so.18 else ln-s/usr/local/lib/libmcrypt.la/usr/lib/libmcrypt.la ln-s/usr/local/lib/libmcrypt.so/usr/lib/libmcrypt.so ln-s/usr/local/lib/libmcrypt.so.4/usr/lib/libmcrypt.so.4 ln-s/usr/local/lib/libmcrypt.so.4.4.8/usr/lib/libmcrypt.so.4.4.8 ln-s/usr/local/lib/libmhash.a/usr/lib/libmhash.a ln-s/usr/local/lib/libmhash.la/usr/lib/libmhash.la ln-s/usr/local/lib/libmhash.so/usr/lib/libmhash.so ln-s/usr/local/lib/libmhash.so.2/usr/lib/libmhash.so.2 ln-s/usr/local/lib/libmhash.so.2.0.1/usr/lib/libmhash.so.2.0.1 ln-s/usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-config ln-s/usr/local/mysql/lib/libmysqlclient.so.18/lib/libmysqlclient.so.18 fi tarxzfmcrypt-2.6.8.tar.gz cdmcrypt-2.6.8 /sbin/ldconfig ./configure make makeinstall cd../ ln-s/usr/local/mysql/lib/libmysqlclient.so.18/usr/lib if[`getconfWORD_BIT`='32'] [`getconfLONG_BIT`='64'];then ln-s/usr/lib64/libpng.*/usr/lib/ ln-s/usr/lib64/libjpeg.*/usr/lib/ fi if[!`grep-l /lib '/etc/ld.so.conf'`];then echo /lib  /etc/ld.so.conf fi if[!`grep-l'/usr/lib''/etc/ld.so.conf'`];then echo /usr/lib  /etc/ld.so.conf fi if[-d /usr/lib64 ] [!`grep-l'/usr/lib64''/etc/ld.so.conf'`];then echo /usr/lib64  /etc/ld.so.conf fi if[!`grep-l'/usr/local/lib''/etc/ld.so.conf'`];then echo /usr/local/lib  /etc/ld.so.conf fi /sbin/ldconfig tarxzfphp-5.3.10.tar.gz useradd-M-s/sbin/nologinwww cdphp-5.3.10 ./configure--prefix=$php_dir--with-mysql=$mysql_dir--with-mysqli=$mysql_dir/bin/mysql_config--with-iconv-dir=/usr/local--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--disable-rpath--enable-safe-mode--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--with-curl--with-curlwrappers--enable-mbregex--enable-fpm--enable-mbstring--with-mcrypt--with-gd--enable-gd-native-ttf--with-openssl--with-mhash--enable-pcntl--enable-sockets--with-ldap--with-ldap-sasl--with-xmlrpc--enable-ftp--enable-zip--enable-soap--disable-debug makeZEND_EXTRA_LIBS='-liconv'makeinstall cpphp.ini-production$php_dir/lib/php.ini cd../ tarxzfmemcache-2.2.5.tgz cdmemcache-2.2.5 $php_dir/bin/phpize ./configure--with-php-config=$php_dir/bin/php-config make makeinstall cd../ tarxjfeaccelerator-0.9.6.1.tar.bz2 cdeaccelerator-0.9.6.1 /usr/local/php/bin/phpize ./configure--enable-eaccelerator=shared--with-php-config=$php_dir/bin/php-config make makeinstall cd../ tarxzfPDO_MYSQL-1.0.2.tgz cdPDO_MYSQL-1.0.2 $php_dir/bin/phpize ./configure--with-php-config=$php_dir/bin/php-config--with-pdo-mysql=$mysql_dir make makeinstall cd../ tarxzfImageMagick-6.6.7-10.tar.gz cdImageMagick-6.6.7-10 ./configure make makeinstall cd../ tarxzfimagick-2.3.0.tgz cdimagick-2.3.0 /usr/local/php/bin/phpize ./configure--with-php-config=$php_dir/bin/php-config make makeinstall cd../ #Modiryphp.ini mkdir/tmp/eaccelerator /bin/chown-Rwww.www/tmp/eaccelerator/ sed-i'808aextension_dir= '$php_dir'/lib/php/extensions/no-debug-non-zts-20090626/ '$php_dir/lib/php.ini sed-i'809aextension= memcache.so '$php_dir/lib/php.ini sed-i'810aextension= pdo_mysql.so '$php_dir/lib/php.ini sed-i'811aextension= imagick.so '$php_dir/lib/php.ini sed-i'134aoutput_buffering=On'$php_dir/lib/php.ini sed-i'847acgi.fix_pathinfo=0'$php_dir/lib/php.ini sed-i's@;date.timezone=@date.timezone=Asia/Shanghai@g'$php_dir/lib/php.ini echo'[eaccelerator] zend_extension= '$php_dir'/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so eaccelerator.shm_size= 64 eaccelerator.cache_dir= /tmp/eaccelerator eaccelerator.enable= 1 eaccelerator.optimizer= 1 eaccelerator.check_mtime= 1 eaccelerator.debug= 0 eaccelerator.filter= eaccelerator.shm_max= 0 eaccelerator.shm_ttl= 0 eaccelerator.shm_prune_period= 0 eaccelerator.shm_only= 0 eaccelerator.compress= 0 eaccelerator.compress_level= 9 eaccelerator.keys= disk_only eaccelerator.sessions= disk_only eaccelerator.content= disk_only ' $php_dir/lib/php.ini echo';;;;;;;;;;;;;;;;;;;;; ;FPMConfiguration; ;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;; ;GlobalOptions; ;;;;;;;;;;;;;;;;;; [global] pid=run/php-fpm.pid error_log=log/php-fpm.log log_level=noticeemergency_restart_threshold=30emergency_restart_interval=1mprocess_control_timeout=5sdaemonize=yes;;;;;;;;;;;;;;;;;;;; ;PoolDefinitions; ;;;;;;;;;;;;;;;;;;;; [www] listen=127.0.0.1:9000 listen.backlog=-1 listen.allowed_clients=127.0.0.1 listen.owner=wwwlisten.group=wwwlisten.mode=0666user=wwwgroup=wwwpm=dynamicpm.max_children=32pm.start_servers=4pm.min_spare_servers=4pm.max_spare_servers=16pm.max_requests=512request_terminate_timeout=0request_slowlog_timeout=0slowlog=log/$pool.log.slow rlimit_files=51200rlimit_core=0catch_workers_output=yesenv[HOSTNAME]=$HOSTNAME env[PATH]=/usr/local/bin:/usr/bin:/bin env[TMP]=/tmp env[TMPDIR]=/tmp env[TEMP]=/tmp' $php_dir/etc/php-fpm.conf echo $php_dir/sbin/php-fpm  /etc/rc.local $php_dir/sbin/php-fpm echo' ?phpinfo(); ? ' $nginx_dir/html/phpinfo.php echo phpinstallsuccess! } #installnginx 安装nginx的模块functioninstall_nginx() { cd$installhere/soft/nginx tarxzfpcre-8.12.tar.gz cdpcre-8.12 ./configure make makeinstall cd../ tarxzfngx_cache_purge-1.3.tar.gz tarxzfnginx-1.0.12.tar.gz cdnginx-1.0.12 #ModifynginxEditioninformation sed-i's@#defineNGINX_VERSION.*$@#defineNGINX_VERSION 1.0 @g'src/core/nginx.h sed-i's@#defineNGINX_VER.*NGINX_VERSION$@#defineNGINX_VER YWS/ NGINX_VERSION@g'src/core/nginx.h ./configure--prefix=$nginx_dir--user=www--group=www--with-http_stub_status_module--with-http_ssl_module--add-module=../ngx_cache_purge-1.3 make makeinstall cd$installhere/soft/nginx/ cpnginx.sh/etc/init.d/nginx chmod755/etc/init.d/nginx chkconfig--addnginx chkconfignginxon rm-rf$nginx_dir/conf/nginx.conf cpnginx.conf$nginx_dir/conf/nginx.conf echo ulimit-SHn65535  /etc/rc.local echo $nginx_dir/sbin/nginx  /etc/rc.local echo'#ADD net.ipv4.tcp_max_syn_backlog=65536net.core.netdev_max_backlog=32768net.core.somaxconn=32768net.core.wmem_default=8388608net.core.rmem_default=8388608net.core.rmem_max=16777216net.core.wmem_max=16777216net.ipv4.tcp_timestamps=0net.ipv4.tcp_synack_retries=2net.ipv4.tcp_syn_retries=2net.ipv4.tcp_tw_recycle=1#net.ipv4.tcp_tw_len=1net.ipv4.tcp_tw_reuse=1net.ipv4.tcp_mem=94500000915000000927000000 net.ipv4.tcp_max_orphans=3276800#net.ipv4.tcp_fin_timeout=30#net.ipv4.tcp_keepalive_time=120net.ipv4.ip_local_port_range=102465535' /etc/sysctl.conf /sbin/sysctl-p echo'#!/bin/bash #Thisscriptrunat00:00 #TheNginxlogspath logs_path= '$nginx_dir'/logs/ mkdir-p${logs_path}$(date-d yesterday + %Y )/$(date-d yesterday + %m )/ mv${logs_path}access.log${logs_path}$(date-d yesterday + %Y )/$(date-d yesterday + %m )/access_$(date-d yesterday + %Y%m%d ).log kill-USR1`cat'$nginx_dir'/nginx.pid`' $nginx_dir/sbin/cut_nginx_log.sh chmod755$nginx_dir/sbin/cut_nginx_log.sh echo 0000***/bin/bash$nginx_dir/sbin/cut_nginx_log.sh  /var/spool/cron/root $nginx_dir/sbin/nginx echo nginxinstallsuccess! } #checkinstall 检测模块functioninstall_check() { echo ==========================Checkinstall================================ clear if[-s$nginx_dir];then echo $nginx_dir[found] else echo Error:$nginx_dirnotfound!!! fi if[-s$php_dir];then echo $php_dir[found] else echo Error:$php_dirnotfound!!! fi if[-s$mysql_dir];then echo $mysql_dir[found] else echo Error:$mysql_dirnotfound!!! fi echo ==========================Checkinstall================================ if[-s$nginx_dir] [-s$php_dir] [-s$mysql_dir];then echo LNMPiscompleted! echo defaultmysqlrootpassword:$mysql_passwd echo Thepathofsomedirs: echo mysqldir:$mysql_dir echo phpdir:$php_dir echo phpinfo:$nginx_dir/html/phpinfo.php echo nginxdir:$nginx_dir echo webdir:$nginx_dir/html echo ========================================================================== else echo Sorry,FailedtoinstallLNMP! echo Pleasecheckerrorsandlogs. fi } case$1in install_yum) install_yum ;; init) start_time init end_time ;; install_mysql) start_time install_mysql end_time ;; install_nginx) start_time install_nginx end_time ;; install_php) start_time install_php end_time ;; install_lnmp) start_time init install_mysql install_nginx install_php end_time ;; install_check) start_time install_check end_time ;; *) echo Usage:`basename$0`{install_yum|init|install_mysql|install_nginx|install_php|install_lnmp|install_check} ;; esac 

现在进行lnmp的安装(使用nohup)

[root@localhosttmp]#nohupshinstall_lnmp.shinstall_lnmp [1]6861 [root@localhosttmp]#nohup:appendingoutputto`nohup.out' 

可以看到安装已经在后台进行,并且安装情况都输出到nohup.out里了现在就是漫长的等待了……

[root@localhosttmp]# [1]+Donenohupshinstall_lnmp.shinstall_lnmp 

结果可以看到脚本运行完成

现在可以看出脚本运行完成,我们查看一下日志

[root@localhosttmp]#tail-fnohup.out net.ipv4.tcp_synack_retries=2net.ipv4.tcp_syn_retries=2net.ipv4.tcp_tw_recycle=1net.ipv4.tcp_tw_reuse=1net.ipv4.tcp_mem=94500000915000000927000000 net.ipv4.tcp_max_orphans=3276800net.ipv4.ip_local_port_range=102465535 nginxinstallsuccess! SunMar2503:47:26EDT2012Finishinstall! Totalruntime:68Minutes 

可以看到安装运行了68分钟(我在脚本里设置了运行时间,所以可以帮助我们观察脚本运行的时间)。分别查看msyql、 nginx、php是否启动

[root@localhosttmp]#ps-ef|grepmysql root93373848003:49pts/200:00:00grepmysql root254021003:09pts/200:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe--datadir=/data/mysql/data--pid-file=/data/mysql/mysql.pid mysql2628025402003:09pts/200:00:00/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/data/mysql/data--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--log-error=/data/mysql/mysql_error.log--open-files-limit=10240--pid-file=/data/mysql/mysql.pid--socket=/tmp/mysql.sock--port=3306[root@localhosttmp]#ps-ef|grepnginx root93211003:47?00:00:00nginx:masterprocess/usr/local/nginx/sbin/nginx www93229321003:47?00:00:00nginx:workerprocess www93259321003:47?00:00:00nginx:workerprocess www93269321003:47?00:00:00nginx:workerprocess www93279321003:47?00:00:00nginx:workerprocess www93289321003:47?00:00:00nginx:workerprocess www93299321003:47?00:00:00nginx:workerprocess www93309321003:47?00:00:00nginx:workerprocess www93319321003:47?00:00:00nginx:workerprocess root93393848003:49pts/200:00:00grepnginx [root@localhosttmp]#ps-ef|grepphp root34311003:45?00:00:00php-fpm:masterprocess(/usr/local/php/etc/php-fpm.conf) www34323431003:45?00:00:00php-fpm:poolwww www34333431003:45?00:00:00php-fpm:poolwww www34343431003:45?00:00:00php-fpm:poolwww www34353431003:45?00:00:00php-fpm:poolwww root93413848003:49pts/200:00:00grepphp 

从输出可以看到,mysql、php、nginx都已经启动了,我们在网页里查看一下nginx与phpinfo.php

网页能打开,证明nginx安装成功

可以看到php也已经安装完成

下面我们在来通过install_check来检查lnmp是否安装完成

[root@localhosttmp]#shinstall_lnmp.shinstall_check SunMar2504:04:24EDT2012Startinstall! ==========================Checkinstall================================ /usr/local/nginx[found] /usr/local/php[found] /usr/local/mysql[found] ==========================Checkinstall================================ LNMPiscompleted! defaultmysqlrootpassword:admin Thepathofsomedirs: mysqldir:/usr/local/mysql phpdir:/usr/local/php phpinfo:/usr/local/nginx/html/phpinfo.php nginxdir:/usr/local/nginx webdir:/usr/local/nginx/html========================================================================== SunMar2504:04:24EDT2012Finishinstall! Totalruntime:0Seconds 

可以看到,lnmp已经安装完成。

希望大家能在使用本脚本过程中帮我进行纠错与建议,谢谢!

BTW:感谢9楼小愚的建议,我经过测试发现是有他所说的问题出现,现在我已经把脚本修改了一下,修改内容为cp php.ini到$php_dir/lib目录下。

希望能与小愚及各位同好一起交流、学习!

一个背包,几本书,所有喜欢的歌,

模块化的安装lnmp脚本推荐

相关文章:

你感兴趣的文章:

标签云: