lnmp环境安装详细
2016-10-23 本文已影响57人
小直
yum -y install gcc gcc-c++ autoconf automake make
yum -y install pcre*
yum -y install openssl*
cd /usr/local/
#安装nginx
curl http://nginx.org/download/nginx-1.7.8.tar.gz >> ./nginx-1.7.8.tar.gz
tar -xvf nginx-1.7.8.tar.gz
mv nginx-1.7.8 nginx
cd nginx
./configure --prefix=/usr/local/nginx-1.7.8 \
--with-http_ssl_module --with-http_spdy_module \
--with-http_stub_status_module --with-pcre
make
make install
vi ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/nginx-1.7.8/sbin
source ~/.bash_profile
/usr/local/nginx-1.7.8/sbin/nginx
/usr/local/nginx-1.7.8/sbin/nginx -s reload
/usr/local/nginx-1.7.8/sbin/nginx -s stop
yum -y install libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel curl curl-devel php-mcrypt libmcrypt libmcrypt-devel openssl-devel gd
#安装加解密扩展库,centos下会出现yum安装不上的情况,需要手动安装扩展
cd /usr/local/src
curl http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz >> ./libmcrypt-2.5.8.tar.gz
tar zxvf ./libmcrypt-2.5.8.tar.gz
cd cd libmcrypt-2.5.8
./configure
make
make install
#安装php5.4
cd /usr/local
curl http://cn.php.net/distributions/php-5.4.40.tar.gz >> ./php-5.4.40.tar.gz
tar -xvf ./php-5.4.40.tar.gz
mkdir /usr/local/php5.4
./configure --prefix=/usr/local/php5.4 --with-config-file-path=/usr/local/php5.4/etc --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-pear --with-gettext --enable-session --with-mcrypt --with-curl --with-libxml-dir=/usr/lib64
make && make install
cp /usr/local/php-5.4.40/php.ini-production /usr/local/php5.4/lib/php.ini
cp /usr/local/php5.4/etc/php-fpm.conf.default /usr/local/php5.4/etc/php-fpm.conf
/usr/local/php5.4/sbin/php-fpm
ps axu |fgrep php-fpm
vi ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/nginx-1.7.8/sbin:/usr/local/php5.4/bin
source ~/.bash_profile
#安装mysql
#创建用户组
groupadd mysql
#创建用户
useradd -g mysql mysql
#安装cmake,mysql5.1以上需要使用cmake编译
yum install cmake ncurses-devel bison
cd /usr/local/
curl http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.50.tar.gz >> ./mysql-5.5.50.tar.gz
tar -xvf mysql-5.5.50.tar.gz
cd mysql-5.5.50
#设置mysql用户权限
chown -R mysql:mysql /usr/local/mysql5.5
mkdir /data/mysql/
chmod 777 /data/mysql/
#安装数据库
wget -O mysql5.5.tar.gz http://mirrors.sohu.com/mysql/MySQL-5.5//mysql-5.5.55-linux2.6-x86_64.tar.gz
tar -xvf mysql5.5.tar.gz
cd /usr/local/src/mysql-5.5.55 && cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.5 -DMYSQL_DATADIR=/data/mysql5.5 -DSYSCONFDIR=/etc \
&& make && make install
#初始化数据库
cd /usr/local/mysql5.5/scripts
./mysql_install_db --user=mysql --basedir=/usr/local/mysql5.5 --datadir=/data/mysql/
vi ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/php5.4/bin:/usr/local/nginx-1.7.8/sbin:/usr/local/mysql5.5/bin
source ~/.bash_profile