lnmp環境安裝詳細

weixin_34337265發表於2016-10-23
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

相關文章