[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/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