1、 更换阿里云yum源并安装epel源
[root@localhost ~]# yum -y install vim wget
[root@localhost ~]# mv /etc/yum.repos.d//CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[root@localhost ~]# wget http://mirrors.aliyun.com/repo/Centos-7.repo -O /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# yum -y install epel-release
[root@localhost ~]# yum -y update
2、安装apache-2.4.6,启动服务后并进行验证
[root@localhost ~]# yum -y install httpd httpd-devel
[root@localhost ~]# systemctl start httpd && systemctl enable httpd
[root@localhost ~]# httpd -v
或者安装Nginx1.20.1
[root@localhost ~]# yum -y install nginx
[root@localhost ~]# systemctl enable --now nginx
[root@localhost ~]# nginx -v
3、配置防火墙
[root@localhost ~]# firewall-cmd --zone=public --permanent --add-service=http
[root@localhost ~]# sys