How to configure Nginx official Yum source in CentOS

WBOY
Release: 2023-05-28 08:44:04
forward
1977 people have browsed it

Since there is no nginx we want in the yum source, we need to create a "/etc/yum.repos.d/nginx.repo" file, which is actually adding a yum source.

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

Then copy the following content:

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

After saving the "/etc/yum.repos.d/nginx.repo" file, we will use the yum command to query our Is the yum source of nginx configured?

[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
Copy after login

If the execution command displays like this, then our nginx yum source is configured successfully!

Then if you want to install our nginx, just execute it directly:

[root@localhost ~]# yum -y install nginx
Copy after login

If the operation is correct, the nginx environment will be installed ok.

Of course you can also use the command to check whether the installation is complete.

[root@localhost ~]# rpm -q nginx
nginx version: nginx/1.12.2
Copy after login

No explanation, it has been successful, and it is the latest official version of nginx.

The above is the detailed content of How to configure Nginx official Yum source in CentOS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!