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」。
繼續閱讀