RHEL6配置yum源為網易映象
轉載:https://www.jianshu.com/p/446e3fe7d710
由於 redhat的yum線上更新是收費的,如果沒有註冊的話不能使用,如果要使用,需將redhat的yum解除安裝後,重啟安裝,再配置其他源.
本文包括配置本地源及第三方源。第三方源包括:網易,epel,repoforge,rpmfusion。以下以網易映象為例進行著重講解。本案例用到的相關檔案見頁面最底部。
剛安裝完RHEL6以後直接yum命令得到如下所示的找不到匹配項的結果:
[[email protected] data]# yum search nginx
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Warning: No matches found for: nginx
No Matches found
[
操作步驟:
1.刪除redhat原有的yum
rpm -aq|grep yum|xargs rpm -e --nodeps
2.下載yum安裝檔案
注意,如果下載時找不到檔案,就登入到:http://mirrors.163.com/centos/6/os/x86_64/ 上查詢相應的檔案。然後再下載,部分rpm包版本可能有所不同,如果報404可到http://mirrors.163.com/centos/6/os/x86_64/Packages/搜尋包名即可。
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-69.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
3.進行安裝yum
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-3.2.29-60.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
注意最後兩個包必需同時安裝,否則會相互依賴
----------配置網易源
4.更新repo檔案
mv /etc/yum.repos.d/rhel-source.repo /etc/yum.repos.d/rhel-source.repo.bak
vi /etc/yum.repos.d/rhel-debuginfo.repo
內容為:
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6
#packages used/produced in the build but not released
#[addons]
name=CentOS-$releasever - Addons
#baseurl=http://mirrors.163.com/centos/6/addons/$basearch/
#gpgcheck=1
#gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/6./centosplus/$basearch/
gpgcheck=1
enabled=0
5、yum clean all
6、yum install vim
如果使用過程中出現如下的NOKEY的提示的話:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
執行如下命令即可:
rpm --import http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6
相關檔案下載:yum-appendixes