CentOS 5/6 改为可用的 yum 套件库来源 (2022)

若执行 yum 出现:

http://mirror.centos.org/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
To address this issue please refer to the below knowledge base article

表示系统默认的 yum 套件库可能已经不存在!

我们可以在 vault.centos.org 找到可用的套件库来源:

  • vault.centos.org: http
  • archive.kernel.org: http - rsync (rsync://archive.kernel.org::centos-vault/)
  • linuxsoft.cern.ch: http - rsync (rsync://linuxsoft.cern.ch/centos-vault/)
  • mirror.nsc.liu: http - rsync (rsync://mirror.nsc.liu.se::centos-store/)

继续阅读

如何解决 yum 安装 glibc-headers 失败的问题

最近我用 yum 在安装套件时,突然出现这些错误讯息:

---> Package glibc-headers.x86_64 0:2.12-1.107.el6 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.107.el6.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.107.el6.x86_64
--> Finished Dependency Resolution
Error: Package: glibc-headers-2.12-1.107.el6.x86_64 (base)
           Requires: kernel-headers >= 2.2.1
Error: Package: glibc-headers-2.12-1.107.el6.x86_64 (base)
           Requires: kernel-headers
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

错误讯息有提到跟 "kernel" 有关!!

原来是我当初为了不让 yum 自动更新 Kernel,所以我在 "/etc/yum.conf" 加了这一行:

exclude=kernel*

把这一行删除就好了。之后如果遇到有关 Kernel 的失败状况,应该都是这个问题。

解决无法读取 mcrypt 模组的问题

明明已经用 yum 安装 php-mcrypt 了,在登入 phpMyAdmin 时,却出现了错误讯息:

无法读取 mcrypt 模组, 请检查 PHP 设定

执行 php -v ,也出现:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/module.so' - /usr/lib64/php/modules/module.so: cannot open shared object file: No such file or directory in Unknown on line 0
; Enable mcrypt extension module

依照错误讯息,到 /usr/lib64/php/modules/ 查看,确实没有“module.so”,倒是有一个 “mcrypt.so”。
继续阅读