转自 http://wlheihei.com/view/64
[[email protected] yum.repos.d]# yum install nginx
Loaded plugins: fastestmirror, priorities, refresh-packagekit, security
Loading mirror speeds from cached hostfile
163 packages excluded due to repository priority protections
Setting up Install Process
No package nginx available.
Error: Nothing to do
没法使用yum安装
百度之,找到的第一个答案是没有安装EPEL,则安装之
[[email protected] yum.repos.d]# rpm -Uvh ftp://ftp.univie.ac.at/systems/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving ftp://ftp.univie.ac.at/systems/linux/fedora/epel/6/x86_64/epel-release-6-
8.noarch.rpm
Preparing... ##################
###### [100%]
package epel-release-6-8.noarch is already installed
之后照样执行yum install nginx依然错误
之后发现这台机器上已经编译安装过nginx,找一台新机器,尝试后依然错误。
[[email protected] local]# yum info nginx
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.cug.edu.cn
* extras: mirrors.cug.edu.cn
* updates: mirrors.cug.edu.cn
Error: No matching Packages to list
经查询原来是没有nginx的yum源包
直接安装一个nginx的yum源文件
[[email protected] local]# rpm -ivh http://nginx.org/packages/centos/
6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
Retrieving http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-
0.el6.ngx.noarch.rpm
warning: /var/tmp/rpm-tmp.y29UIV: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY
Preparing... ######################## [100%]
1:nginx-release-centos ########################### [100%]
[[email protected] local]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# ll
总用量 20
-rw-r--r--. 1 root root 1926 12月 9 2011 CentOS-Base.repo
-rw-r--r--. 1 root root 637 12月 9 2011 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 626 12月 9 2011 CentOS-Media.repo
-rw-r--r--. 1 root root 113 10月 14 2011 nginx.repo
-rw-r--r--. 1 root root 1250 11月 8 17:40 puppetlabs.repo
就可以使用yum install nginx安装了
[[email protected] local]# yum install nginx
Setting up Install Process
Loading mirror speeds from cached hostfile
* epel: mirrors.opencas.cn
nginx | 2.9 kB 00:00
nginx/primary_db | 8.3 kB 00:00
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 0:1.8.1-1.el6.ngx will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================================================================================
Installing:
nginx x86_64 1.8.1-1.el6.ngx nginx 352 k
Transaction Summary
====================================================================================================================================================================================================
Install 1 Package(s)
Total download size: 352 k
Installed size: 872 k
Is this ok [y/N]: y
Downloading Packages:
nginx-1.8.1-1.el6.ngx.x86_64.rpm | 352 kB 00:12
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : nginx-1.8.1-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.8.1-1.el6.ngx.x86_64 1/1
Installed:
nginx.x86_64 0:1.8.1-1.el6.ngx
Complete!