首頁 >後端開發 >php教程 >lnmp 環境搭建 原始碼包安裝 linux,nginx,mysql,php

lnmp 環境搭建 原始碼包安裝 linux,nginx,mysql,php

WBOY
WBOY原創
2016-08-08 09:22:161045瀏覽

環境:contos 6.5

說明:

原始碼目錄:/data/software/soft

安裝目錄:/usr/local/webserver/

原始碼套件: http://pan.baidu.com/s.baidu.com/s /1kTy3UXh

準備:

yum -y install gcc automake autoconf libtool make

yum -y install gcc gcc-c++ glibc

yum -y install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-de
vel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb
5 krb5-devel libidn libidn-devel openssl openssl-devel

安裝php腳本:
spath=/data/software/soft
cd ${spath}
tar zvxf php-5.6.9.tar.gz
cd php-5.6.9


webpath=/usr/local/webserver

./configure --prefix=${webpath}/php  --enable-fpm  --with-openssl  --with-mcrypt --enable-mbstring --with-curl --disable-debug  --disable-rpa
th --enable-inline-optimization --with-bz2  --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --
with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli --with-gd --with-jpeg-dir

make all install

安裝nginx準備,安裝zlib,openssl,pcre 腳本:

spath=/data/software/soft
cd ${spath}
tar -xzvf pcre-8.34.tar.gz 
tar -xzvf openssl-1.0.1c.tar.gz 
tar -xzvf zlib-1.2.8.tar.gz
cd ${spath}/zlib-1.2.8
./configure
make && make install

cd ${spath}/openssl-1.0.1c
./config 
./config -t
make && make install

cd ${spath}/pcre-8.34
./configure
make
make install

安裝nginx腳本(包含echo 和 realip 模組 ):
webpath=/usr/local/webserver
spath=/data/software/soft
cd ${spath}
tar xzvf nginx-1.4.2.tar.gz
tar xzvf echo-nginx-module-0.57.tar.gz
cd nginx-1.4.2
./configure --sbin-path=${webpath}/nginx/nginx --conf-path=${webpath}/nginx/nginx.conf --pid-path=${webpath}/nginx/nginx.pid --with-http_ssl_
module --with-pcre=${spath}/pcre-8.34 --with-zlib=${spath}/zlib-1.2.8 --with-openssl=${spath}/openssl-1.0.1c --add-module=/data/software/soft
/echo-nginx-module-0.57 --with-http_realip_module
make && make install
安裝mysql腳本
yum install ncurses-devel
groupadd mysql
useradd -r -g mysql mysql
spath=/data/software/soft
cd ${spath}
tar zvxf mysql-5.6.16.tar.gz
cd mysql-5.6.16
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql -DMYSQL_UNIX_ADDR=/usr/local/webserver/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFA
ULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATA
DIR=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1
make && make install
chown mysql.mysql -R /usr/local/webserver/mysql
chown mysql.mysql -R /data/mysqldb
/usr/local/webserver/mysql/scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb
cp /usr/local/webserver/mysql/support-files/my-default.cnf /etc/my.cnf
mysql相關操作
cp support-files/mysql.server /etc/init.d/mysqld 

vim /etc/profile //加入到$PATH中

      PATH=/usr/local/webserver/mysql/bin:/usr/local/webserver/mysql/lib:$PATH

      export PATH

source /etc/profile //使生效

service mysqld start //启动mysql
chkconfig --level 35 mysqld on //设置开机启动

netstat -tulnp | grep 3306 //查看端口
mysql -u root -p //登录

mysqladmin -u root password '123456' //设置密码


以上就介紹了lnmp 環境搭建 原始碼包安裝 linux,nginx,mysql,php,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn