修改yum來源為本地Local光碟片安裝:
/etc/yum.repos.d下兩個文件CentOS-Base.repo(Internet安裝) CentOS-Media.repo(本地Local來源)
修改CentOS-Media.repo
1 2 3 4 5 6 |
[c5-media] name=CentOS-$releasever - Media baseurl=file:///media/ 此處為掛載目錄掛載點 gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 千萬不要註釋掉,否則後面yum時提示沒有KEY |
解決 sh: lsb_release: command not found 的問題
lsb_release -a
bash: lsb_release: command not found
我要安裝lsb相關套件,執行以下指令即可安裝光碟裡的相關套件
1 |
yum --disablerepo=\* --enablerepo=c5-media install redhat-lsb |
採用上面的yum方式,則會從本地光碟安裝 redhat-lsb 套件
如果我要替換其他地方,一樣是修改CentOS-Media.repo
我把光碟片的內容都 Copy到 /home/Centos511裡面
修改CentOS-Media.repo
1 2 3 4 5 |
[Local] name=Local baseurl=file:///home/Centos511 enable=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 |
執行
1 |
yum --disablerepo=\* --enablerepo=Local install redhat-lsb |
安裝完套件後檢查lsb_release
執行
1 2 3 4 5 6 7 |
lsb_release -a LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 5.11 (Final) Release: 5.11 Codename: Final |