Centos添加官方repo
1. yum查看当前nginx可用包
yum list | grep nginx
2. 添加nginx官方repo
cd /etc/yum.repos.d
vim nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch
gpgcheck=0
enable=1
3. 查看nginx repo是否成功
yum list | grep nginx
[360iot@Server-c382a248 yum.repos.d]$ yum list | grep nginx
nginx.x86_64 1.18.0-1.el6.ngx nginx
nginx-debug.x86_64 1.8.0-1.el6.ngx nginx
nginx-debuginfo.x86_64 1.18.0-1.el6.ngx nginx
nginx-module-geoip.x86_64 1.18.0-1.el6.ngx nginx
nginx-module-geoip-debuginfo.x86_64 1.18.0-1.el6.ngx nginx
nginx-module-image-filter.x86_64 1.18.0-1.el6.ngx nginx
nginx-module-image-filter-debuginfo.x86_64 1.18.0-1.el6.ngx nginx
nginx-module-njs.x86_64 1.18.0.0.4.1-1.el6.ngx nginx
nginx-module-njs-debuginfo.x86_64 1.18.0.0.4.1-1.el6.ngx nginx
nginx-module-perl.x86_64 1.18.0-1.el6.ngx nginx
nginx-module-perl-debuginfo.x86_64 1.18.0-1.el6.ngx nginx
nginx-module-xslt.x86_64 1.18.0-1.el6.ngx nginx
nginx-module-xslt-debuginfo.x86_64 1.18.0-1.el6.ngx nginx
nginx-nr-agent.noarch 2.0.0-12.el6.ngx nginx
pcp-pmda-nginx.x86_64 3.10.9-9.el6 base
5. 查看架构
arch
[360iot@Server-c382a248 yum.repos.d]$ arch
x86_64
6. 查看系统大版本
rpm -qi centos-release
[360iot@Server-c382a248 yum.repos.d]$ rpm -qi centos-release
Name : centos-release Relocations: (not relocatable)
Version : 6 Vendor: CentOS
Release : 4.el6.centos.10 Build Date: Mon 25 Feb 2013 04:57:43 PM CST
Install Date: Fri 20 May 2016 06:56:51 PM CST Build Host: c6b8.bsys.dev.centos.org
Group : System Environment/Base Source RPM: centos-release-6-4.el6.centos.10.src.rpm
Size : 32670 License: GPLv2
Signature : RSA/SHA1, Fri 01 Mar 2013 10:01:26 PM CST, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem <http://bugs.centos.org>
Summary : CentOS release file
Description :
CentOS release file
6. yum安装nginx
[360iot@Server-c382a248 yum.repos.d]$ yum -y install nginx
7. 查看安装版本号
[360iot@Server-c382a248 yum.repos.d]$ rpm -q nginx
nginx version: nginx/1.18.0