安装nginx1.14
将nginx1.14源增加到CentOS7.4中
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
安装nginx
yum install nginx
执行nginx-v,显示nginx的版本号,说明已安装成功
nginx -v
增加开机自动启动:
sudo systemctl enable nginx
nginx相关操作
systemctl start nginx #启动nginx systemctl stop nginx #停止nginx systemctl restart nginx #重启nginx systemctl reload nginx #重载nginx
安装后访问服务器ip,能够访问nginx的默认页
安装php7.2
如果之前有安装过php,执行下列指令,将所安装的php都删除
yum -y remove php*
增加php7.x源,执行下列指令
yum -y install epel-release 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
然后我们可以使用yum search php
查看以及添加的php源,会有很多的phpx.xw开头的东西,yum install php72w
这是安装7.2版本的php,如需要安装其他版本选择其他即可。
安装php7.2扩展,可自行选择
yum -y install php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
如要安装mssql的sqlsrv扩展,请移步至:【笔记】CentOS 下 PHP7.2 安装 mssql 扩展
执行php -v或php-fpm -v,显示php的版本号,说明已安装成功
php-fpm -v
增加开机自动启动:
sudo systemctl enable php-fpm
php相关操作:
systemctl start php-fpm #启动php systemctl stop php-fpm #停止php systemctl restart php-fpm #重启php systemctl reload php-fpm #重载php
MySQL8.0安装
下载mysql8源
wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
将刚下载的源添加到系统源中
yum localinstall mysql80-community-release-el7-1.noarch.rpm
执行安装
yum install mysql-community-server.x86_64
如果此处出现如下错误
原因是Mysql的GPG升级了,需要重新获取
输入如下命令获取
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
或输入如下命令不检查GPG
yum -y install mysql-community-server --nogpgcheck
启动mysql
systemctl start mysqld
mysql会自动创建了root密码,要查看root密码,执行以下命令
cat /var/log/mysqld.log | grep password
便会显示mysql当前root的密码
就可以使用该密码登录mysql了
但执行相关操作时,提示需要修改当前密码:
执行以下命令修改密码(密码需要大小字母数字字符组合)
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'ABCdef_111';
参考:
https://blog.csdn.net/qq_39677681/article/details/82025445
https://www.cnblogs.com/php-linux/p/6086404.html
本帖已被设为精华帖!