-------------------------------------------------------------------------------------
Nginx安裝參考地址:http://www.cnblogs.com/farwish/p/3807289.html
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm yum install -y mysql-community-server
成功安裝之后重啟mysql服務:
service mysqld restart 或 systemctl restart mysqld.service
初次安裝mysql是root賬戶是沒有密碼的:
mysql -u root -p 遇到密碼提示,回車即可進入
設置root密碼的方法:
PHP源碼安裝:
1. 下載源碼包並解壓:
wget http://cn2.php.net/distributions/php-5.6.3.tar.gz
tar zxvf php-5.6.3.tar.gz
cd php-5.6.3
2. 安裝依賴:
這些依賴有libxml, libpng, libjpeg, libmcrypt...等
根據提示進行操作,如:yum install libxml2 按Tab鍵查看所有libxml包,我這里安裝 yum install libxml2-devel,然后進行配置。
注:libmcrypt不在centos的網絡yum倉庫中,需要自行下載。
( 一. 源碼安裝方法:
cd /usr/local/src
wget http://softlayer.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz
tar -zxvf libmcrypt-2.5.8.tar.gz
cd /usr/local/src/libmcrypt-2.5.8
./configure --prefix=/usr/local
make && make install
二. 使用第三方yum源
下載:
wget http://www.atomicorp.com/installers/atomic sh ./atomic
yum命令安裝:
yum install php-mcrypt libmcrypt libmcrypt-devel
)
gd中的一些函數依賴freetype, 需要安裝:
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.0.tar.gz
./configure --prefix=/usr/local/freetype/
make && make install
或:yum install -y freetype-devel
其他:
yum install -y curl curl-devel libjpeg libjpeg-devel libpng libpng-devel
3. 配置:
./configure --with-libdir=lib64 --prefix=/usr/local/php --with-mysql --with-mysqli --with-pdo-mysql --enable-inline-optimization --enable-fpm --with-freetype-dir --with-gd --with-zlib --with-png-dir --with-jpeg-dir --enable-mbstring --with-iconv --enable-sockets --with-curl --with-mcrypt --with-openssl --enable-pcntl --enable-soap
4. 編譯安裝:
make && make install
復制一份php的配置文件,新建一個:
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cd /home/weichen/php-5.6.3
cp php.ini-production /usr/local/php/lib/php.ini
/usr/local/php/sbin/php-fpm (注意:需要root權限進行操作)
vim /usr/local/nginx/conf/nginx.conf
location / {
root /home/www; index index.php index.html index.htm; }
location ~ \.php$ {
root /home/www; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; }
CentOS平台自動安裝腳本:https://github.com/farwish/delicateShell
Docker構建LNMP運行環境:https://github.com/phvia/dkc