lnmp環(huán)境搭建教程
我們的準備工作
- yum -y install gcc
- yum -y install gcc-c++
- yum -y install make
- yum -y install libaio
我們需要的軟件
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
- http://zlib.net/zlib-1.2.7.tar.gz
- http://nginx.org/download/nginx-1.2.5.tar.gz
- http://www.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.28-linux2.6-i686.tar.gz/from/http://cdn.mysql.com/
- http://cn2.php.net/get/php-5.4.9.tar.gz/from/tw1.php.net/mirror
- ftp://xmlsoft.org/libxml2/libxml2-2.9.0.tar.gz
解壓我們的軟件
將以上軟件放到/usr/local/src/目錄下,然后解壓它們。
- tar -zxf libxml2-2.9.0.tar.gz
- tar -zxf mysql-5.5.27-linux2.6-i686.tar.gz
- tar -zxf nginx-1.2.4.tar.gz
- tar -zxf pcre-8.31.tar.gz
- tar -zxf php-5.4.7.tar.gz
- tar -zxf zlib-1.2.7.tar.gz
安裝Nginx
- cd /usr/local/src/nginx-1.2.4
- ./configure --prefix=/usr/local/nginx/ --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --with-pcre=../pcre-8.31 --with-zlib=../zlib-1.2.7
- make && make install
用下面的命令啟動nginx
/usr/local/nginx/nginx
安裝mysql
- mv /usr/local/src/mysql-5.5.27-linux2.6-i686 /usr/local/mysql
- cd /usr/local/mysql/
- groupadd mysql
- useradd -r -g mysql mysql
- chown -R mysql .
- chgrp -R mysql .
- cp support-files/my-medium.cnf /etc/my.cnf
- scripts/mysql_install_db --user=mysql
- ./bin/mysqld_safe &
- ./bin/mysql_secure_installation
- chown -R root .
- chown -R mysql data
安裝libxml
- cd /usr/local/src/libxml2-2.9.0
- ./configure --prefix=/usr/local/libxml2/
- make && make install
安裝php
- cd /usr/local/src/php-5.4.7
- ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-libxml-dir=/usr/local/libxml2/ --enable-mbstring --enable-fpm
- make && make install
- cd /usr/local/php/etc
- mv php-fpm.conf.default php-fpm.conf
- /usr/local/php/sbin/php-fpm