ログってなんぼ

エンジニアのメモです

CentOS5.xでyum installできなくなってしまった場合の対応メモ

諸事情で、CentOS5のサーバーをメンテしないといけない場面がまだあったりします・・・

そもそもこの状況をなんとかしないといけないのですが・・・まあそれは置いといて

ntp入れるよ!

$ sudo yum -y install ntp
Loaded plugins: fastestmirror
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/
removing mirrorlist with no valid mirrors: /var/cache/yum/addons/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: addons

もうリポジトリが提供されてないです

$ cat /etc/redhat-release
CentOS release 5.4 (Final)

5.4用のリポジトリを再設定します

/etc/yum.repos.d/centos5.4.vault.repo

[centos5.4.vault]
name=centos5.4.vault
baseurl=http://vault.centos.org/5.4/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
enabled=0

/etc/yum.repos.d/CentOS-Base.repoenabled=0を追記するなりコメントアウトするなりバックアップ取って消すなりします

$ sudo yum install ntp --enablerepo=centos5.4.vault

Loaded plugins: fastestmirror
Determining fastest mirrors
centos5.4.vault                                                                                          | 1.9 kB     00:00
centos5.4.vault/primary_db                                                                               | 760 kB     00:02
puias-unsupported                                                                                        | 1.9 kB     00:00
puias-unsupported/primary_db                                                                             | 352 kB     00:01
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ntp.x86_64 0:4.2.2p1-9.el5.centos.2.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================
 Package              Arch                    Version                                    Repository                        Size
================================================================================================================================
Updating:
 ntp                  x86_64                  4.2.2p1-9.el5.centos.2.1                   centos5.4.vault                  1.3 M

Transaction Summary
================================================================================================================================
Install      0 Package(s)
Update       1 Package(s)
Remove       0 Package(s)

Total download size: 1.3 M
Is this ok [y/N]: y
Downloading Packages:
ntp-4.2.2p1-9.el5.centos.2.1.x86_64.rpm                                                                  | 1.3 MB     00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : ntp                                                                                                      1/2
  Cleanup        : ntp                                                                                                      2/2

Updated:
  ntp.x86_64 0:4.2.2p1-9.el5.centos.2.1

Complete!