CentOS中使用yum更新安装依赖库

在CentOS中使用源码安装的时候,经常遇到缺少某某依赖库的情况,可以使用yum的方式一次性安装所需要的依赖库。在使用yum安装前最好首先 更新一下yum源,这样速度会快很多。

sudo -s
LANG=C
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

PS(2018.3.16): 最近在CentOS7上面安装基础包的时候,出现 Multilib version problems found 错误,信息如下:

Error:  Multilib version problems found. This often means that the root
       cause is something else and multilib version checking is just
       pointing out that there is a problem. Eg.:

         1. You have an upgrade for glib2 which is missing some
            dependency that another package requires. Yum is trying to
            solve this by installing an older version of glib2 of the
            different architecture. If you exclude the bad architecture
            yum will tell you what the root cause is (which package
            requires what). You can try redoing the upgrade with
            --exclude glib2.otherarch ... this should give you an error
            message showing the root cause of the problem.

         2. You have multiple architectures of glib2 installed, but
            yum can only see an upgrade for one of those architectures.
            If you don't want/need both architectures anymore then you
            can remove the one with the missing update and everything
            will work.

         3. You have duplicate versions of glib2 installed already.
            You can use "yum check" to get yum show these errors.

       ...you can also use --setopt=protected_multilib=false to remove
       this checking, however this is almost never the correct thing to
       do as something else is very likely to go wrong (often causing
       much more problems).

这是在一个系统里面有多个版本的包造成的,上面的例子是有多个版本的glib2。
首先使用 rpm -q glib2 查询包的版本,出现两个版本:

glib2-2.46.2-4.el7.x86_64

使用 rpm -e glib2-2.46.2-4.el7.i686 将32位的包卸载,然后再安装就可以了。在卸载的过程中可能会出现依赖包错误的问题,可以将依赖的包先升级再试。

参考资料:
Nginx 0.8.x + PHP 5.2.13(FastCGI)搭建胜过Apache十倍的Web服务器(第6版)[原创]
CentOS 7更新时出现Multilib version problems

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注