linux下安装nginx(yum源安装)

备份yum源

cd /etc/yum.repos.d
mkdir repo_bak
mv *.repo repo_bak/

下载阿里云repo文件

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

清空yum缓存并且生成新的yum缓存

yum clean all
yum makecache

安装软件扩展源

yum install -y epel-release

查看更换的源

yum repolist

安装nginx

yum install nginx

启动

systemctl start nginx

网页查看

在浏览器上输入阿里云你自己服务器的ip地址,访问即可,如下表示启动成功

posted @ 2020-10-31 19:52  我在路上回头看  阅读(1581)  评论(0编辑  收藏  举报