1. 增加源:
vi /etc/yum.repos.d/nginx.repo
1 CentOS: 2 [nginx] 3 name=nginx repo 4 baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ 5 gpgcheck=0 6 enabled=1 7 RHEL: 8 [nginx] 9 name=nginx repo 10 baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/ 11 gpgcheck=0 12 enabled=1
2. 安装
yum install nginx