A、编译安装nginx
(1)上传安装nginx-1.12.2.tar.gz包到/service/tools/(在上传之前先下载lrzsz包 yum install lrzsz -y)
(2)解压tar xf nginx-1.12.2.tar.gz
(3)cd nginx-1.12.2
(4)在编译安装之前先将需要的依赖库和编译软件安装
yum install gcc gcc-c++ glibc -y
yum install pcre-devel -y
yum install zlib-devel -y
yum install openssl-devel -y
(5)编译安装
./configure--prefix=/application/nginx1.12.2--pid-path=/var/run/nginx.pid --user=nginx --group=nginx --with-http_ssl_module
(6)make && make install
(7)配置
ln -s /application/nginx1.12.2/ /application/nginx
useradd -M -s /sbin/nologin -r -u 88 nginx
grep-Ev'^$|#'/application/nginx/conf/nginx.conf.default >/application/nginx/conf/nginx.conf
ln -s /application/nginx/sbin/nginx /usr/bin/
启动
B、编译安装php
(1)上传php-5.5.38.tar.gz包到/service/tools
(2)解压php-5.5.38.tar.gz
tar xf php-5.5.38.tar.gz
(3)安装依赖包
yum install curl curl-devel -y
yum install libjpeg-devel -y
yum install libpng-devel -y
yum install freetype-devel -y
yum install libxml2-devel -y
(4)编译
./configure --prefix=/application/php5.5.38 --with-jpeg-dir=/usr/lib64 --with-freetype-dir=/usr/lib64/ --with-curl --enable-fpm --enable-mbstring --with-gd --with-fpm-user=nginx --with-fpm-group=nginx --with-mysqli=mysqlnd --with-mysql-sock=/tmp/mysql.sock --with-openssl --enable-zip --enable-zlib --with-mysql=mysqlnd
(5)make && make install
(6)配置
cp php.ini-production /application/php5.5.38/etc/php.ini
cp/application/php5.5.38/etc/php-fpm.conf.default/application/php5.5.38/etc/php-fpm.conf
ln -s /application/php5.5.38/ /application/php
(7)启动
ln -s /application/php/sbin/php-fpm /usr/bin/
php-fpm
(8)配置nginx支持php
vim /application/nginx/conf/nginx.conf.default
vim /application/nginx/conf/nginx.conf
(9)编写php文件,查看nginx配置php是否完成
vim index.php
C、编译安装msyql
上传mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz包到/service/tools
解压tar xf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
配置
mv mysql-5.6.36-linux-glibc2.5-x86_64 /application/mysql-5.6.36
ln -s mysql-5.6.36/ mysql
useradd -M -s /sbin/nologin -r -u 90 mysql
初始化数据库实例
./scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
cp support-files/mysql.server /etc/init.d/mysqld
vim /etc/init.d/mysqld
\cp support-files/my-default.cnf /etc/my.cnf
启动
/etc/init.d/mysqld start
ln -s /application/mysql/bin/* /usr/bin/
设置密码
mysqladmin -uroot password '123456'
创建用户授权