一般安裝好redhat后,不能注冊(cè)的話,不能使用系統(tǒng)自帶的yum源。但是我們可以自己配置yum源來(lái)解決這一問(wèn)題。下面介紹下redhat配置163yum源。
1. 檢查是否安裝yum包
rpm -qa |grep yum
2. 刪除自帶的yum包
rpm -qa|grep yum|xargs rpm -e --nodeps
因?yàn)橐恍┌g可能會(huì)有依賴關(guān)系,所以我們需要加上參數(shù) --nodeps 無(wú)視依賴關(guān)系。
3. 下載yum包
Yum包下載地址http://mirrors.163.com/centos/
在這個(gè)網(wǎng)站里,你可以自己選擇需要下載的文件,進(jìn)入形如5/或者6/的文件下載,其他的無(wú)法下載。
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.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-37.el6.noarch.rpm
如果wget時(shí)候,報(bào)http...504等錯(cuò)誤,則進(jìn)入linux,修改etc/hosts文件,添加一行:www.abc.com????? 192.168.xx.xx
4. 解壓yum包
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm --force --nodeps
5. 替換yum源
cd? /etc/yum.repos.d/
wget? http://mirrors.163.com/.help/CentOS6-Base-163.repo
vi CentOS6-Base-163.repo
注意原來(lái)的yum源配置文件是rhel-source.repo。這里把CentOS6-Base-163.repo替換掉rhel-source.repo。
mv rhel-source.repo rhel-source.repo.bak
mv CentOS6-Base-163.repo rhel-source.repo
6. 編輯替換后的rhel-source.repo。
#rhel-source.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.? You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
7. 清理并重建緩存
yum clean all
yum makecache
8. 更新yum
yum update
至此,redhat配置163yum源完成