0.准备依赖
yum install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel libxml2-devel curl-devel
1.Nginx
wget http://nginx.org/download/nginx-1.14.0.tar.gz
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module
make && make install
把/usr/local/nginx/sbin/nginx加入到环境变量
vim /etc/profile # 添加到末尾 PATH=$PATH:/usr/local/nginx/sbin export PATH # 使其修改生效 source /etc/profile
#运行 nginx # 重新载入配置 nginx -s reload # 停止 nginx -s stop
2.PHP
wget http://cn2.php.net/distributions/php-7.1.16.tar.gz
./configure --prefix=/usr/local/php --enable-fpm --enable-pcntl --with-curl --with-openssl --with-gettext --enable-pdo --enable-ctype --enable-mbstring --enable-simplexml --enable-ftp --enable-sockets --enable-bcmath --enable-soap --with-pdo-mysql
把/usr/local/php/bin/php加入到环境变量
vim /etc/profile # 添加到末尾 PATH=$PATH:/usr/local/php/bin export PATH PATH=$PATH:/usr/local/php/sbin export PATH # 使其修改生效 source /etc/profile
cd /usr/local/php/etc cp php-fpm.conf.default php-fpm.conf cd php-fpm.d cp www.conf.default www.conf
#修改php-fpm.conf,打开php-fpm.pid 去掉pid = run/php-fpm.pid前面的; #开启 php-fpm #关闭 kill -INT `cat /usr/lical/php/var/run/php-fpm.pid` 或者 pkill php-fpm #重启 kill -USER2 `cat /usr/local/php/var/run/php-fpm.pid`
3.Mysql
# 获取Mysql官网的Yum Repository wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm # 本地yum添加rpm源 yum localinstall mysql80-community-release-el7-1.noarch.rpm # 检测源是否安装 yum repolist enabled | grep "mysql.*-community.*"
# 安装
yum install mysql-community-server
#开启mysql systemctl start mysqld # 查看mysql状态 systemctl status mysqld # 开机启动mysql systemctl enable mysqld systemctl daemon-reload
修改mysql默认的root密码
# 查看默认生成的root密码 grep 'temporary password' /var/log/mysqld.log # 进入mysql设置密码 # mysql5.7默认安装了密码安全检查插件(validate_password) # 默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号 # 并且长度不能少于8位。否则会提示ERROR 1819 (HY000): # Your password does not satisfy the current policy requirements错误 mysql -uroot -p ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
还有一个问题,就是因为安装了Yum Repository,以后每次yum操作都会自动更新,需要把这个卸载掉
yum remove mysql80-community-release.noarch
PS:可以修改vim /etc/yum.repos.d/mysql-community.repo
源,改变默认安装的mysql版本。比如要安装5.6版本,将5.7源的enabled=1改成enabled=0。然后再将5.6源的enabled=0改成enabled=1即可