1. 增加nginx yum仓库
vi /etc/yum.repos.d/nginx.repo
CentOS增加这段:
[nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1
RHEL增加这段:
[nginx] name=nginx repo baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/ gpgcheck=0 enabled=1
2. 安装nginx
把文件保存后执行:
yum install nginx
[[email protected] ~]# yum install nginx
已加载插件:fastestmirror
设置安装进程
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* epel: mirrors.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
解决依赖关系
--> 执行事务检查
---> Package nginx.x86_64 0:1.12.0-1.el6.ngx will be 安装
--> 完成依赖关系计算
依赖关系解决
================================================================================
软件包 架构 版本 仓库 大小
================================================================================
正在安装:
nginx x86_64 1.12.0-1.el6.ngx nginx 915 k
事务概要
================================================================================
Install 1 Package(s)
总下载量:915 k
Installed size: 2.5 M
确定吗?[y/N]:y
下载软件包:
nginx-1.12.0-1.el6.ngx.x86_64.rpm | 915 kB 00:31
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
正在安装 : nginx-1.12.0-1.el6.ngx.x86_64 1/1
----------------------------------------------------------------------
Thanks for using nginx!
Please find the official documentation for nginx here:
* http://nginx.org/en/docs/
Commercial subscriptions for nginx are available on:
* http://nginx.com/products/
----------------------------------------------------------------------
Verifying : nginx-1.12.0-1.el6.ngx.x86_64 1/1
已安装:
nginx.x86_64 0:1.12.0-1.el6.ngx
完毕!