源已经更新到最新版本:https://mirrors.tencent.com/,安装还是报错如下:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
No package nginx available.
Error: Nothing to do
您好,可以尝试下如下方法
# yum install -y epel-release
# yum update
# yum install -y nginx
通过添加扩展包来发现nginx
通常epel源中是有nginx的,如果配置epel无法实现,可以直接配置nginx官方源,配置方式如下:
#在/etc/yum.repos.d/目录中创建nginx.repo仓库文件,内容如下:
[root@www.lutixia.cn ~]# cat /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
创建好nginx.repo文件之后,就直接安装nginx了:
yum install nginx -y