centos8安装nignx最新版
centos8安装nignx最新版
创建官方repo源
[root@izgu3e8gvhx2vgz ~]# vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
生成缓存
dnf makecache
安装nginx
dnf install -y nginx # 之前安装的版本不用卸载
Total 255 kB/s | 819 kB 00:03
warning: /var/cache/dnf/nginx-stable-614ef03fac352fea/packages/nginx-1.20.1-1.el8.ngx.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY
nginx stable repo 1.6 kB/s | 1.5 kB 00:00
Importing GPG key 0x7BD9BF62:
Userid : "nginx signing key <signing-key@nginx.com>"
Fingerprint: 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62
From : https://nginx.org/keys/nginx_signing.key
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: nginx-1:1.20.1-1.el8.ngx.x86_64 1/1
Running scriptlet: nginx-1:1.20.1-1.el8.ngx.x86_64 1/2
Upgrading : nginx-1:1.20.1-1.el8.ngx.x86_64 1/2
warning: /etc/nginx/nginx.conf created as /etc/nginx/nginx.conf.rpmnew
Running scriptlet: nginx-1:1.20.1-1.el8.ngx.x86_64 1/2
Running scriptlet: nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 2/2
Cleanup : nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 2/2
Running scriptlet: nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 2/2
Verifying : nginx-1:1.20.1-1.el8.ngx.x86_64 1/2
Verifying : nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 2/2
Upgraded:
nginx-1:1.20.1-1.el8.ngx.x86_64
Complete!
查看版本
[root@VM-0-13-centos ~]# nginx -v
nginx version: nginx/1.20.1