CentOS怎么配置Nginx官方的Yum源

由于yum源中沒(méi)有我們想要的nginx,那么我們就需要?jiǎng)?chuàng)建一個(gè)“/etc/yum.repos.d/nginx.repo”的文件,其實(shí)就是新增一個(gè)yum源。

[root@localhost?~]#?vim?/etc/yum.repos.d/nginx.repo

然后將下面的內(nèi)容復(fù)制進(jìn)去:

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

然后保存“/etc/yum.repos.d/nginx.repo”文件后,我們就使用yum命令查詢(xún)一下我們的nginx的yum源配置好了沒(méi)有。

[root@localhost?~]#?yum?list?|grep?nginx nginx.x86_64????????????????1:1.12.2-1.el7_4.ngx????nginx nginx-debug.x86_64?????????????1:1.8.0-1.el7.ngx??????nginx nginx-debuginfo.x86_64???????????1:1.12.2-1.el7_4.ngx????nginx nginx-module-geoip.x86_64?????????1:1.12.2-1.el7_4.ngx????nginx nginx-module-geoip-debuginfo.x86_64????1:1.12.2-1.el7_4.ngx????nginx nginx-module-image-filter.x86_64??????1:1.12.2-1.el7_4.ngx????nginx nginx-module-image-filter-debuginfo.x86_64?1:1.12.2-1.el7_4.ngx????nginx nginx-module-njs.x86_64??????????1:1.12.2.0.1.14-1.el7_4.ngx?nginx nginx-module-njs-debuginfo.x86_64?????1:1.12.2.0.1.14-1.el7_4.ngx?nginx nginx-module-perl.x86_64??????????1:1.12.2-1.el7_4.ngx????nginx nginx-module-perl-debuginfo.x86_64?????1:1.12.2-1.el7_4.ngx????nginx nginx-module-xslt.x86_64??????????1:1.12.2-1.el7_4.ngx????nginx nginx-module-xslt-debuginfo.x86_64?????1:1.12.2-1.el7_4.ngx????nginx nginx-nr-agent.noarch???????????2.0.0-12.el7.ngx??????nginx pcp-pmda-nginx.x86_64???????????3.11.8-7.el7????????base

如果執(zhí)行命令是這樣的顯示效果,那么我們的nginx的yum源就配置成功啦!

然后要安裝我們的nginx就直接執(zhí)行:

[root@localhost?~]#?yum?-y?install?nginx

如果操作正確到這里nginx環(huán)境就已經(jīng)安裝ok了。

當(dāng)然你還可以使用命令查一下究竟是否安裝完成。

[root@localhost?~]#?rpm?-q?nginx nginx?version:?nginx/1.12.2

不解釋?zhuān)呀?jīng)成功了,并且是nginx官方的最新版本。

? 版權(quán)聲明
THE END
喜歡就支持一下吧
點(diǎn)贊5 分享