Detailed explanation of CentOS configuration of Nginx official Yum source

Detailed explanation of CentOS configuration of Nginx official Yum source

I have been using the CentOS purchased by Alibaba Cloud for project deployment. Recently, when I built a virtual machine on my local machine to carry out some project contacts, I found that using the command yum -y
install nginx cannot install nginx. The yum repository of the local centos system does not have nginx. The problem can be solved by searching for information. The following is a record:

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

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

Then copy the following content into it:

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

Then after saving the "/etc/yum.repos.d/nginx.repo" file, we use the yum command to check whether our nginx yum source is 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

If the command execution shows this effect, then our nginx yum source is configured successfully!

Then to install our nginx just execute:

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

If the operation is correct, the nginx environment has been 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

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

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of nginx signal set case
  • Introduction to Nginx log management
  • Install multiple versions of PHP for Nginx on Linux
  • Detailed tutorial on installing PHP and Nginx on Centos7
  • A universal nginx interface to implement reverse proxy configuration
  • Solve the problem of refreshing blank when deploying Vue project nginx to non-root directory
  • How to install Nginx and configure multiple domain names
  • When Nginx is turned on, the port is occupied and prompts: Address already in use
  • Solution to the problem that docker nginx cannot be accessed after running
  • How to redirect to https through nginx load balancing
  • Nginx signal control

<<:  Detailed explanation of how to configure multi-threaded master-slave replication from MySQL 5.7 slave nodes

>>:  JavaScript to achieve digital clock effect

Recommend

Canvas draws scratch card effect

This article shares the specific code for drawing...

Summary of constructor and super knowledge points in react components

1. Some tips on classes declared with class in re...

Sample code for implementing PC resolution adaptation in Vue

Table of contents plan Install Dependencies Intro...

MySQL data type details

Table of contents 1. Numeric Type 1.1 Classificat...

mysql three tables connected to create a view

Three tables are connected. Field a of table A co...

DOM operation table example (DOM creates table)

1. Create a table using HTML tags: Copy code The ...

How to migrate mysql storage location to a new disk

1. Prepare a new disk and format it with the same...

Web design tips on form input boxes

1. Dashed box when cancel button is pressed <br...

How to Rename a Group of Files at Once on Linux

In Linux, we usually use the mv command to rename...

How to deploy LNMP architecture in docker

Environmental requirements: IP hostname 192.168.1...

How to import txt into mysql in Linux

Preface When I was writing a small project yester...

Practical record of Vue3 combined with TypeScript project development

Table of contents Overview 1. Compositon API 1. W...

How to use React forwardRef and what to note

Previously, react.forwardRef could not be applied...

Nginx monitoring issues under Linux

nginx installation Ensure that the virtual machin...