实验步骤
1、检查系统是否安装了yum
[[email protected] ~]# rpm -qa |grep yum
PackageKit-yum-plugin-0.5.8-23.el6.x86_64
yum-metadata-parser-1.1.2-16.el6.x86_64
yum-utils-1.1.30-30.el6.noarch
yum-3.2.29-60.el6.noarch
yum-plugin-security-1.1.30-30.el6.noarch
PackageKit-yum-0.5.8-23.el6.x86_64
yum-rhn-plugin-0.9.1-50.el6.noarch
2、删除已安装的yum软件包
[[email protected] ~]# rpm -qa |grep yum |xargs rpm -e --nodeps /直接删除yum包,不检查依赖关系
[[email protected] ~]# rpm -qa |grep yum
[[email protected] ~]#
3、下载新的RHEL6.6yum包
注:这里我下载的是CentOS6.6yum包,原因是mirrors.163.com镜像站点中没有RHEL,而CentOS6.6和它架构一样,所以没有什么影响,不必担心。
需要下载的yum包:
yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
yum-3.2.29-60.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
[[email protected] ~]# wget http://mirrors.163.com/centos/6.6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm /其余软件下载方式同样
也可直接通过网站下载:
下载地址:http://mirrors.163.com/centos/6.6/os/x86_64/Packages
还可以通过本文中的附件进行下载
4、安装yum软件包
[[email protected] rpm]# rpm -ivh yum-3.2.29-60.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm /这样安装可以解决yum包依赖关系
warning: yum-3.2.29-60.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
1:yum-metadata-parser ########################################### [ 33%]
2:yum-plugin-fastestmirro########################################### [ 67%]
3:yum ########################################### [100%]
[[email protected] rpm]#
5、更新yum源
[[email protected] rpm]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# ls
packagekit-media.repo rhel-source.repo
[[email protected] yum.repos.d]# rm -rf ./* /删除“yum.repos.d”目录中旧有的“.repo”文件
[[email protected] yum.repos.d]# vim Base.repo /新建Base.repo文件,并输入以下内容
[base]
name=redhat-6.6-Base-163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#名称最好做到见名之意,对后续不会有影响
#下载软件的链接地址
#是否启用gpg检查gpgkey,1是开启,0是关闭
#开启gpgcheck后,通过gpgkey来指定,相应的gpg文件,如果不指定gpgkey文件,那么就必须手动的导入相应的gpg文件,
[updates]
name=redhat-6.6-updates-163.com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[extras]
name=redhat-6.6-Extras-163.com
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[centosplus]
name=redhat-6.6-Plus-163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[contrib]
name=redhat-6.6-contrib-163.com
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
6、清除原有缓存
[[email protected] yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base extras updates
Cleaning up Everything
7、重建缓存,以提高搜索、安装软件的速度
[[email protected] yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Determining fastest mirrors
base | 3.7 kB 00:00
base/group_gz | 216 kB 00:00
base/filelists_db | 6.1 MB 00:26
base/primary_db | 4.6 MB 00:19
base/other_db | 2.8 MB 00:12
.............................................
Metadata Cache Created
8、更新系统
[[email protected] yum.repos.d]# yum update /更新时间可能过慢,视具体情况而定
至此,本文档已经结束,文档中难免有不尽人意之处,希望各位能够给出宝贵的建议,谢谢!
紫禁之巅
2015年8月5日 13:36