1.下载nginx的rpm包
[root@chen ~]# wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
--2015-12-31 23:05:21-- http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
正在解析主机 nginx.org... 206.251.255.63, 95.211.80.227, 2001:1af8:4060:a004:21::e3
正在连接 nginx.org|206.251.255.63|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:4311 (4.2K) [application/x-redhat-package-manager]
正在保存至: “nginx-release-centos-6-0.el6.ngx.noarch.rpm”
100%[================================================>] 4,311 --.-K/s in 0s
2015-12-31 23:05:25 (39.1 MB/s) - 已保存 “nginx-release-centos-6-0.el6.ngx.noarch.rpm” [4311/4311])
2. 解压rpm包
[root@chen ~]# rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm
warning: nginx-release-centos-6-0.el6.ngx.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY
Preparing... ########################################### [100%]
1:nginx-release-centos ########################################### [100%]
3. 安装nginx
[root@chen ~]# yum install nginx
已加载插件:fastestmirror, security
设置安装进程
Determining fastest mirrors
* base: mirrors.skyshe.cn
* extras: mirrors.skyshe.cn
* updates: mirrors.opencas.cn
base | 3.7 kB 00:00
base/primary_db | 3.6 MB 00:05
file:///mnt/repodata/repomd.xml: [Errno 14] Could not open/read file:///mnt/repodata/repomd.xml
尝试其他镜像。
extras | 3.4 kB 00:00
extras/primary_db | 30 kB 00:00
nginx | 2.9 kB 00:00
nginx/primary_db | 6.8 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 3.1 MB 00:18
解决依赖关系
--> 执行事务检查
---> Package nginx.i386 0:1.8.0-1.el6.ngx will be 安装
--> 完成依赖关系计算
依赖关系解决
==========================================================================================
软件包 架构 版本 仓库 大小
==========================================================================================
正在安装:
nginx i386 1.8.0-1.el6.ngx nginx 360 k
事务概要
==========================================================================================
Install 1 Package(s)
总下载量:360 k
Installed size: 835 k
确定吗?[y/N]:y
下载软件包:
nginx-1.8.0-1.el6.ngx.i386.rpm | 360 kB 00:14
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
Warning: RPMDB altered outside of yum.
正在安装 : nginx-1.8.0-1.el6.ngx.i386 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.8.0-1.el6.ngx.i386 1/1
已安装:
nginx.i386 0:1.8.0-1.el6.ngx
完毕!
4. 测试
[root@chen ~]# service nginx start
正在启动 nginx: [确定]
[root@chen ~]# service nginx stop
停止 nginx: [确定]