[root@localhost data]# vim /etc/yum.repos.d/nginx.reponginx
在這個文件中寫入如下內容:vim
[nginx]centos
name=nginx repoide
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/url
gpgcheck=0debug
enabled=1ip
退出保存後,咱們可使用yum命令來查詢nginx的yum源配置好了沒有。get
[root@localhost data]# yum list | grep nginxit
若是顯示如下效果:class
nginx.x86_641:1.10.1-1.el7.ngx nginx
nginx-debug.x86_64 1:1.8.0-1.el7.ngx nginx
nginx-debuginfo.x86_64 1:1.10.1-1.el7.ngx nginx
nginx-module-geoip.x86_64 1:1.10.1-1.el7.ngx nginx
nginx-module-image-filter.x86_64 1:1.10.1-1.el7.ngx nginx
nginx-module-njs.x86_64 1:1.10.1.0.0.20160414.1c50334fbea6-1.el7.ngx
nginx
nginx-module-perl.x86_64 1:1.10.1-1.el7.ngx nginx
nginx-module-xslt.x86_64 1:1.10.1-1.el7.ngx nginx
nginx-nr-agent.noarch 2.0.0-9.el7.ngx nginx
pcp-pmda-nginx.x86_64 3.10.6-2.el7 base
則咱們nginx的yum源就配置成功啦!
最後就能夠直接安裝:
[root@localhost data]# yum -y install nginx