-------------------------------------------------------------------------------------
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