首页 > 代码库 > lnmp

lnmp

环境 centos6.7  64位

#软件版本

nginx-1.6.3+php-5.5.32+mysql-5.5.49

#安装依耐包

yum  install  openssl   openssl-devel  pcre    pcre-devel  -y

wget  -q  http://nginx.org/download/nginx-1.6.3.tar.gz

#创建目录

mkdir  /application    

cd  /application

#建立用户,指定登录shell   不创建家目录

useradd www -s  /sbin/nologin  -M

tar xf nginx-1.6.3.tar.gz

#切换到此文件下配置,否则的话会出错

cd  nginx-1.6.3

./configure   --user=www    --group=www   --with-http_ssl_module  --with-http_stub_status_module   --prefix=/application/nginx-1.6.3/

#编译  安装

make  && make install

#创建软连接

ln -s /application/nginx-1.6.3     /application/nginx 



2、安装PHP5.3.27:

#yum安装各种依赖包

yum install zlib-devel libxml2-devel openssl-devel libjpeg-devel libjpeg-turbo-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libmcrypt-devel mhash mcrypt  -y


#检查安装包(共12个rpm)

rpm -qa  zlib-devel libxml2-devel openssl-devel libjpeg-devel libjpeg-turbo-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libmcrypt-devel mhash mcrypt 

mkdir  -p  /home/shy/tools/

#下载并安装libiconv

cd  /home/shy/tools/

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

tar zxvf libiconv-1.14.tar.gz

cd libiconv-1.14

./configure --prefix=/usr/local/libiconv

make

make install



cd /home/shy/tools/

wget http://mirrors.sohu.com/php/php-5.5.32.tar.gz

tar xf php-5.5.32.tar.gz

cd php-5.5.32


#编译安装PHP

./configure \

--prefix=/application/php5.5.32 \

#--with-apxs2=/application/apache/bin/apxs \

--with-mysql=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-iconv-dir=/usr/local/libiconv \

--with-freetype-dir \

--with-jpeg-dir \

--with-png-dir \

--with-zlib \

--with-libxml-dir=/usr \

--enable-xml \

--disable-rpath \

--enable-bcmath \

--enable-shmop \

--enable-sysvsem \

--enable-inline-optimization \

--with-curl \

--enable-mbregex \

--enable-mbstring \

--with-mcrypt \

--with-gd \

--enable-gd-native-ttf \

--with-openssl \

--with-mhash \

--enable-pcntl \

--enable-sockets \

--with-xmlrpc \

--enable-zip \

--enable-soap \

--enable-short-tags \

--enable-static \

--with-xsl \

--enable-ftp



make

make install



ln -s /application/php5.5.32/ /application/php

ls /application/php



#查看模板文件(位于解压目录/home/oldboy/tools/php-5.5.35)

cd /home/shy/tools/php-5.5.32

ll php.ini*

-rw-r--r-- 1 1000 1000 68881 Apr 29 02:12 php.ini-development

-rw-r--r-- 1 1000 1000 68913 Apr 29 02:12 php.ini-production


#拷贝模板文件为php.ini

cp php.ini-production /application/php/lib/php.ini




安装mysql


mkdir /application

rz -y

tar xf mysql-5.5.49-linux2.6-x86_64.tar.gz

mv  mysql-5.5.49-linux2.6-x86_64     /application/mysql-5.5.49       

ln -s     /application/mysql-5.5.49  /application/mysql

useradd  -s  /sbin/nologin  mysql  -M


cd /application/mysql

chown -R mysql.mysql   /application/mysql/


./scripts/mysql_install_db --basedir=/application/mysql/   --datadir=/application/mysql/data/  --user=mysql

make 

make  install                  

\cp  support-files/my-small.cnf     /etc/my.cnf

cp support-files/mysql.server  /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld

sed -i ‘s#/usr/local/#/application/#g‘  /application/mysql/bin/mysqld_safe

#启动mysql

/etc/init.d/mysqld  start

#查看mysql进程是否启动

netstat  -lntup|grep mysql


本文出自 “7177651” 博客,请务必保留此出处http://7187651.blog.51cto.com/7177651/1844364

lnmp