您的位置:首页 > 其它

redhat 6配置163 yum源

2013-05-29 00:34 323 查看
1,删除redhat原有的yum,
rpm -qa | grep yum | xargs rpm -e --nodeps;
2,下载yum安装文件
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.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-14.1.el6.x86_64.rpm
rpm -ivh yum-3.2.27-14.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm
注意最后两个包必需同时安装,否则会相互依赖

4,下载yum公钥导入证书
wget http://vault.centos.org/6.3/os/x86_64/RPM-GPG-KEY-CentOS-6
rpm --import RPM-GPG-KEY-CentOS-6

5,下载CentOS-Base.repo文件到/etc/yum.repos.d中;
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo -O /etc/yum.repos.d/CentOS6-Base.repo
6,vim 修改下载来的文件,把其中的$releasever全部替换成6.3,保存,参考命令:s/$releasever/6.3/g或sed -i 's/\$releasever/6.3/g' /etc/yum.repos.d/CentOS6-Base.repo
7,yum clean all 清除yum的缓存,
8,yum update -y 更新软件包。

RedHat5.6使用CentOS yum源更新的方法
================================================================================

由于RedHat的yum在线更新是收费的,我们的RedHat没有注册,不能在线更新下载rpm包。
需将RedHat的yum卸载后,重启安装Centos的yum,再配置其他yum源。
先进入yum源配置目录
cd /etc/yum.repos.d

备份系统自带的yum源
mv CentOS-Base.repo CentOS-Base.repo.save

下载其他更快的yum源
中科大的yum源:(现在打不开了 )
wget http://centos.ustc.edu.cn/CentOS-Base.repo
163的yum源:
wget http://mirrors.163.com/.help/CentOS-Base-163.repo 修改CentOS-Base.repo (不修改会报错),下载到本地把“$releasever”,替换成“5”

sohu的yum源
wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
更新玩yum源后,建议更新一下,使操作立即生效
yum makecache

一、确认RedHat的版本
cat /etc/redhat-release
uname -m

二、删除redhat原有的yum源
rpm -aq|grep yum|xargs rpm -e --nodeps

三、下载CentOS的yum安装包(163源) (可以在这里手工找rpm包:http://mirrors.163.com/centos/)
32位系统:
wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm 64位系统:
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
还依赖python-iniparse-0.2.3-4.el5.noarch.rpm,
但我的系统里已安装了,是系统默认Python2.4中自带的。
如果你的系统没有安装,请安装吧。

四、安装yum软件包
32位系统:
rpm -ivh yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
rpm -ivh yum-3.2.22-39.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
注意:最后两个安装包要放在一起同时安装,否则会提示相互依赖,安装失败。

64位系统:
rpm -ivh yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
rpm -ivh yum-3.2.22-39.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
注意:最后两个安装包要放在一起同时安装,否则会提示相互依赖,安装失败。

五、更改yum源 #我们使用网易的CentOS镜像源
cd /etc/yum.repos.d/
vi CentOS6-Base-163.repo
# CentOS-Base.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-5 - Base - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/5/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-5 - Updates - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-5 - Addons - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=addons
baseurl=http://mirrors.163.com/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-5 - Extras - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=centosplus
baseurl=http://mirrors.163.com/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=contrib
baseurl=http://mirrors.163.com/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

六、清理
yum clean all
yum makecache

如果报错:imary.sqlite.bz2 from base: [Errno 256] No more mirrors to try.
执行:yum makecache

七、更新
cd /etc/pki/rpm-gpg
wget http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
yum update

很长时间的下载后,报错:

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
GPG key retrieval failed: [Errno 5] OSError: [Errno 2] No such file or directory: '/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5'
这是因为:指定的文件/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5在本地不存在导致的。

解决:
去官网http://mirror.centos.org/centos/下载相应文件
cd /etc/pki/rpm-gpg
wget http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
本文出自 “My linux life” 博客,请务必保留此出处http://mllakb.blog.51cto.com/6842774/1212363
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: