微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

LNMP安装过程

实验的过程:
 tar zvxf MysqL-5.1.60.tar.gz -C /usr/src
    cd /usr/src/MysqL-5.1.60/
 
    ./configure --prefix=/usr/local/MysqL
  
    make && make install
 
 PATH=$PATH:/usr/local/MysqL/bin
  echo $PATH
   mkdir -p /var/run/MysqLd   
   useradd -M -s /sbin/nologin MysqL
   chown -R  MysqL /usr/local/MysqL/
   /usr/local/MysqL/bin/MysqL_install_db --user=MysqL
   /usr/local/MysqL/bin/MysqLd_safe --user=MysqL
cd /usr/src/MysqL-5.1.60
  cp -p support-files/MysqL.server /etc/rc.d/init.d/MysqLd
    chmod a+x /etc/rc.d/init.d/MysqLd
  chkconfig --add MysqLd
   chkconfig --list MysqLd
ln -s /var/lib/MysqL/MysqL.sock /tmp/MysqL.sock
   netstat -nultp | grep ":3306"
ln -s /usr/local/MysqL/bin/MysqL /usr/bin/
service MysqLd start
    MysqLadmin -u root password '123456'
   netstat -nultp
   kill 13424
   netstat -nultp
 service MysqLd start
 MysqL -u root -p
   MysqLdump -u root -p yy02 > /yy02.bak
  ls /yy02.bak 
  MysqL -u root -p
   MysqL -u root -p yy02 < /yy02.bak
   MysqL -u root -p
 

Nginx安装配置
tar zxvf pcre-8.20.tar.gz -C /
     cd /pcre-8.20/
    ./configure && make && make install

[root@localhost ~]# tar zxvf Nginx-1.1.4.tar.gz

[root@localhost Nginx-1.1.4]# ./configure --prefix=/usr/local/Nginx

[root@localhost Nginx-1.1.4]# make && make install

[root@localhost ~]# cd /usr/local/Nginx/html/
[root@localhost html]# vi index.PHP 
<?PHP
PHPinfo();
?>
[root@localhost html]# cd ../conf/
[root@localhost conf]# vi Nginx.conf  

        location ~ .PHP$ {
            root           html;
            fastcgi_pass   192.168.1.192:9000;   //
            fastcgi_index  index.PHP;
            fastcgi_param  SCRIPT_FILENAME  /usr/local/Nginx/html$fastcgi_script_name;
            include        fastcgi_params;

[root@localhost conf]# cd /etc/init.d/
[root@localhost init.d]# vi Nginxd (书写启动的shell)

#!/bin/bash
#Author ethnicity(Just a check of others)
#Time 2011-9-24
Nginxd=/usr/local/Nginx/sbin/Nginx
Nginx_config=/usr/local/Nginx/conf/Nginx.conf
Nginx_pid=/usr/local/Nginx/logs/Nginx.pid

RETVAL=0
prog="Nginx"

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x $Nginxd ] || exit 0


# Start Nginx daemons functions.
start() {

if [ -e $Nginx_pid ];then
   echo "Nginx already running...."
   exit 1
fi

 echo -n $"Starting $prog: "
   daemon $Nginxd -c ${Nginx_config}
   RETVAL=$?
   echo
   [ $RETVAL = 0 ] && touch /var/lock/subsys/Nginx
   return $RETVAL

}


# Stop Nginx daemons functions.
stop() {
        echo -n $"Stopping $prog: "
        killproc $Nginxd
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/Nginx /var/run/Nginx.pid
}

# reload Nginx service functions.
reload() {

    echo -n $"Reloading $prog: "
    #kill -HUP `cat ${Nginx_pid}`
    killproc $Nginxd -HUP
    RETVAL=$?
    echo

}

# See how we were called.
case "$1" in
start)
        start
        ;;

stop)
        stop

        ;;

reload)
        reload
        ;;

restart)
        stop
        start
        ;;

status)
        status $prog
        RETVAL=$?
        ;;
*)
        echo $"Usage: $prog {start|stop|restart|reload|status|help}"
        exit 1
esac

exit $RETVAL

[root@localhost init.d]# chmod a+x Nginxd

[root@localhost ~]# service Nginxd  restart
                                            


PHP的相关配置
1、安装libpng
tar xvf libpng-1.2.10.tar.tar
cd libpng-1.2.10
./configure --prefix=/usr/local/png
make;make install
ln -s /usr/local/png/lib/* /usr/lib/
2、安装jpeg
mkdir /usr/local/jpeg
mkdir /usr/local/jpeg/bin
mkdir /usr/local/jpeg/lib
mkdir /usr/local/jpeg/include
mkdir /usr/local/jpeg/man
mkdir /usr/local/jpeg/man/man1
tar xvf jpegsrc.v7.tar.tar
cd jpeg-7
./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
make;make install
ln -s /usr/local/jpeg/lib/* /usr/lib/
3、安装 freetype
tar xvf freetype-2.3.9.tar.tar
cd freetype-2.3.9
./configure --prefix=/usr/local/freetype
make;make install
4、安装fontconfig
tar zxvf fontconfig-2.4.2.tar.gz
cd fontconfig-2.4.2
./configure --prefix=/usr/local/fontconfig --with-freetype-config=/usr/local/freetype/bin/freetype-config
make;make install
5、安装GD
tar zxvf gd-2.0.32.tar.gz
cd gd-2.0.32
./configure --prefix=/usr/local/gd --with-png=/usr/local/png --with-jpeg=/usr/local/jpeg --with- freetype=/usr/local/freetype --with-fontconfig=/usr/local/fontconfig
cp /usr/local/png/include/png.h ./
cp /usr/local/png/include/pngconf.h ./
make;make install

 tar zxvf PHP-5.2.17.tar.gz

 gzip -cd PHP-5.2.17-fpm-0.5.14.diff.gz |patch -d PHP-5.2.17 -p1   //打补丁的步骤

 ./configure --prefix=/usr/local/PHP --with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/png --with-freetype-dir=/usr/local/freetype --with-MysqL=/usr/local/MysqL --enable-fastcgi --enable-fpm


 make && make install
 cd /usr/local/PHP/etc/
 vi PHP-fpm.conf (找到修改如下的语句前面的注释去掉)

 <value name="listen_address">192.168.1.192:9000</value>   //本机的实际IP

                        Unix user of processes                        <value name="user">nobody</value>                       

                        Unix group of processes                        <value name="group">nobody</value>

<value name="allowed_clients">192.168.1.192</value>  //此IP就是Nginx主机的IP,这里是安装在同一台机器上,所以采用相同ip

 cd ~/PHP-5.2.17
  cp PHP.ini-recommended /usr/local/lib/PHP.ini (设置PHP的主配置文件

 vim /usr/local/PHP/etc/PHP-fpm.conf 
把下面那几行的注释去掉
                        Unix user of processes
                        <value name="user">nobody</value>                               

                        Unix group of processes
                        <value name="group">nobody</value>

cd /usr/local/PHP/sbin/PHP-fpm 
./PHP-fpm restart(开启监控的功能


、测试的部分

[root@localhost ~]# /etc/init.d/Nginxd restart
Stopping Nginx:                                            [  OK  ]
Starting Nginx:                                            [  OK  ]
[root@localhost ~]# /usr/local/PHP-5.2.17/sbin/PHP-fpm restart
Shutting down PHP_fpm . done
Starting PHP_fpm  done
在IE地址栏里输入http://192.168.1.192/index.PHP  即可以出现PHP那个经典的测试网页了!
 tar zvxf PHPMyAdmin-3.4.9-all-languages.tar.gz -C /usr/local/Nginx/html
   
   cd /usr/local/Nginx/html

  mv PHPMyAdmin-3.4.9-all-languages/ PHPmyadmin

 cd PHPmyadmin/

  cp config.sample.inc.PHP config.inc.PHP 
   vim config.inc.PHP 
$cfg['Servers'][$i]['host'] = '127.0.0.1';

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐