解决centos yum安装”No package nginx available.”问题

问题描述:

[root@Centos ~]# yum install nginx
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* addons: mirror.bit.edu.cn
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirror.bit.edu.cn
Setting up Install Process
No package nginx available.
Nothing to do

问题原因:

nginx位于第三方的yum源里面,而不在centos官方yum源里面

解决方法:

安装epel(Extra Packages for Enterprise Linux)

a、去epel网站http://fedoraproject.org/wiki/EPEL下载

b、我的系统是centos5.7,cpu是x86_64,所以我下载的是wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

如果是centos6, 则应该下载 wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

c、安装epel

rpm -ivh epel-release-5-4.noarch.rpm

再次执行 yum install nginx,则会提示安装成功了

注:

epel的安装跟centos的系统版本、cpu硬件架构有关,

查看系统版本(lsb-release -a),

查看cpu硬件架构(arch)

epel它是RHEL 的 Fedora 软件仓库,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。装上了 EPEL,就像在 Fedora 上一样,可以通过 yum install package-name,随意安装软件。

使用上述的命令解决了,可出现了新的问题:

Loaded plugins: fastestmirror, refresh-packagekit, security Loading

mirror speeds from cached hostfile

Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

——————————————————————————

use this command:

sudo sed -i “s/mirrorlist=https/mirrorlist=http/” /etc/yum.repos.d/epel.repo
or alternatively use command

vi /etc/yum.repos.d/epel.repo
go to line number 4 and change the url from

mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
to

mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

1 Comment

Trackbacks & Pingbacks

  1. oakley sunglasses cheap 九月 24, 2015 (11:12 下午)

    Thanks very interesting blog!

Leave a Comment

 
Copyright © 2008-2021 lanxinbase.com Rights Reserved. | 粤ICP备14086738号-3 |