步骤一:安装Nginx
1.运行以下命令安装Nginx
yum -y install nginx
2.运行以下命令查看Nginx版本
nginx -v
返回结果如下所示,表示Nginx安装成功
nginx version: nginx/1.16.1
3.运行以下命令启动Nginx服务
systemctl start nginx
4.运行以下命令设置Nginx服务开机自启动
systemctl enable nginx
步骤二:安装MySQL
1.运行以下命令更新YUM源
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
2.运行以下命令安装MySQL
yum -y install mysql-community-server
3.运行以下命令查看MySQL版本号
mysql -V
返回结果如下所示,表示MySQL安装成功
mysql Ver 14.14 Distrib 5.7.29, for Linux (x86_64) using EditLine wrapper
4.运行以下命令启动MySQL服务
systemctl start mysqld
5.运行以下命令设置MySQL服务开机自启动
systemctl enable mysqld
6.运行以下命令查看/var/log/mysqld.log文件,获取并记录root用户的初始密码
grep 'temporary password' /var/log/mysqld.log
返回结果如下:
2020-01-16T05:48:47.535748Z 1 [Note] A temporary password is generated for root@localhost: p0/8Tpg>lsHD
步骤三:安装PHP
1.运行以下命令更新YUM源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2.运行以下命令安装PHP7.2和需要的扩展
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml php72w-bcmath
3.运行以下命令开启php-fpm
service php-fpm start
4.运行以下命令设为开机启动
systemctl enable php-fpm