天天看点

yum仓库 Nginx 安装不了错误

今天在做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

贴图:

<a href="https://s4.51cto.com/wyfs02/M02/9D/31/wKiom1l7G7vQiUopAABXcmDc5M8904.png" target="_blank"></a>

以为是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

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

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

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

<a href="http://blog.51cto.com/dadonggg/1951820#">?</a>

<code>    </code><code>[nginx]  </code>

<code>    </code><code>name=nginx repo  </code>

<code>    </code><code>baseurl=http://nginx.org/packages/centos/</code><code>$releasever</code><code>/</code><code>$basearch</code><code>/  </code>

<code>    </code><code>gpgcheck=0  </code>

<code>    </code><code>enabled=1</code>

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

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

<code>    </code><code>[root</code><code>@localhost</code> <code>~]</code><code># yum list | grep nginx      nginx.i386                               1.4.7-1.el6.ngx               @nginx     </code>

<code>    </code><code>nginx-debug.i386                         1.4.7-1.el6.ngx               nginx</code>

会发现就是最新的稳定版

于是直接执行

<code>    </code><code>yum -y install nginx</code>

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

<a href="https://s5.51cto.com/wyfs02/M01/9D/31/wKioL1l7Hk2DQxvCAAArvJCOiSg842.png" target="_blank"></a>

本文转自写个博客骗钱博客51CTO博客,原文链接http://blog.51cto.com/dadonggg/1951820如需转载请自行联系原作者

菜鸟东哥

继续阅读