今天在做yum仓库的时候,安装Nginx,出现下列错误:


--> Finished Dependency Resolution

Error: Package: nginx-1.10.2-1.el6.x86_64 (epel)

           Requires: libpcre.so.0()(64bit)

Error: Package: nginx-mod-http-perl-1.10.2-1.el6.x86_64 (epel)

           Requires: perl(:MODULE_COMPAT_5.10.1)

 You could try using --skip-broken to work around the problem

 You could try running: rpm -Va --nofiles --nodigest

贴图:

wKiom1l7G7vQiUopAABXcmDc5M8904.png


以为是yum源出现了错误,于是使用下面命令更改了下yum源。


将yum源仓库移动到另外一个备份文件中

mv /etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.backup

将外国的yum源地址改为国内阿里yum源仓库,提高访问速度。

wget -O/etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

mv /etc/yum.repos.d/epel.repo/etc/yum.repos.d/epel.repo.backup

mv /etc/yum.repos.d/epel-testing.repo/etc/yum.repos.d/epel-testing.repo.backup

wget -O/etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo


修改完yum源后再次执行  yum install -y nginx   ,结果还是一样的错误!


下面借鉴网络上的解决方法,结果解决了:

1.创建一个文件 /etc/yum.repos.d/nginx.repo,并将下面的内容复制进去:

    [nginx]  
    name=nginx repo  
    baseurl=http://nginx.org/packages/centos/$releasever/$basearch/  
    gpgcheck=0  
    enabled=1

在编辑这个文件时,没有对齐

wKiom1l7HVjg89QbAAAi3LBvEmo085.png于是出现下面错误

wKioL1l7HY7y_c9cAAA_iQnTiVY979.png于是重新将配置文件中[nginx]下面的语句左对齐后,再次使用yum  list列出所有可安装的软件包后正常了。


2.编辑并保存/etc/yum.repos.d/nginx.repo文件后,在命令行下执行

    [root@localhost ~]# yum list | grep nginx      nginx.i386                               1.4.7-1.el6.ngx               @nginx     
    nginx-debug.i386                         1.4.7-1.el6.ngx               nginx

会发现就是最新的稳定版

于是直接执行

    yum -y install nginx

再次安装Nginx后就正常了,出现了我们最喜欢的安装完成界面了。

wKioL1l7Hk2DQxvCAAArvJCOiSg842.png