yum安装nginx时报错:No package nginx available. Error: Nothing to do

[root@localhost ~]# yum install nginx -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirrors.cqu.edu.cn
  • extras: mirrors.njupt.edu.cn
  • updates: mirrors.njupt.edu.cn
    No package nginx available.
    Error: Nothing to do

vim /etc/yum.repos.d/nginx.repo

在文件中写入以下内容:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/releasever/basearch/
gpgcheck=0
enabled=1

然后执行yum install nginx -y
[root@localhost ~]# yum install nginx -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirrors.cqu.edu.cn
  • extras: mirrors.njupt.edu.cn
  • updates: mirrors.njupt.edu.cn
    nginx | 2.9 kB 00:00:00
    nginx/7/x86_64/primary_db | 55 kB 00:00:01
    Resolving Dependencies
    --> Running transaction check
    ---> Package nginx.x86_64 1:1.18.0-1.el7.ngx will be installed
    --> Finished Dependency Resolution

Dependencies Resolved

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。