CentOS8 安装nginx
dnf makecache 更新dnf 仓库缓存
dnf install nginx 安装nginx
(如果要安装最新版本的nginx可以到 Nginx RPMS 查看最新版,复制链接,然后输入命令 dnf install http://nginx.org/packages/centos/8/x86_64/RPMS/nginx-1.18.0-2.el8.ngx.x86_64.rpm)
3.systemctl start nginx 启动nginx
4.systemctl enable nginx 开机启动
5.防火墙开启80和443端口 firewall-cmd --add-service={http,https} --permanent 或者 firewall-cmd --permanent --zone=public --add-port=80/tcp , firewall-cmd --permanent --zone=public --add-port=443/tcp,如果要查询某个端口是否开启,可以用firewall-cmd --query-port=80/tcp 命令
6.重启防火墙 firewall-cmd --reload
CentOS8 安装PHP8
安装epel和remi
dnf install epel-release -y dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
2.开启php8 module
dnf module list php dnf module enable php:8.0
3.安装php8
dnf install php php-cli php-common
4.验证
php -v
CentOS8 安装mysql8
dnf install mysql-server 安装mysql8
systemctl enable mysqld 开机启动
systemctl start mysqld.service 启动服务
mysql_secure_installation 设置root密码等安全步骤
firewall-cmd --add-port=3306/tcp --permanent 3306端口远程开放,如果不允许远程访问则不需要这步
firewall-cmd --reload 重载安全组
Mysql8更改root密码
1.先把root的旧密码置空
use mysql;
update user set authentication_string='' where user='root';
备注:Mysql5.7+ password字段 已改成 authentication_string字段
2.重置成新密码
alter user 'root'@'localhost' identified by 'newpassword';
备注:Mysql8.0修改密码方式已有变化(此处是个坑,需要注意)
Mysql8.0之前:
update user set password=password('root') where user='root';
参考:
https://linuxhint.com/install_nginx_centos8/
https://www.linuxtechi.com/install-php-on-centos-8-rhel-8/
https://docs.fedoraproject.org/en-US/modularity/removing-modules/
本文为Adamin90原创文章,转载无需和我联系,但请注明来自http://www.lixiaopeng.top