标签:yum
#!/bin/bash #1、删除redhat原有的yum源 rpm -aq | grep yum|xargs rpm -e --nodeps rpm -evh python-urlgrabber #2、重新从网上获取yum的安装包 #以root登陆到redhalt系统,默认目录已经切换到 /root,通过wget命令下载相应的yum包。具体命令如下: for packes_yum in [ python-iniparse-0.3.1-2.1.el6.noarch.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-3.2.29-81.el6.centos.noarch.rpm yum-plug in-fastestmirror-1.1.30-40.el6.noarch.rpm python-urlgrabber-3.9.1-11.el6.noarch.rpm ] do [ ! -e $packes_yum ] && wget http://mirrors.sohu.com/centos/6/os/x86_64/Packages/$packes_yum done #3.安装软件包 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 python-urlgrabber-3.9.1-11.el6.noarch.rpm rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm #4、更改yum源,使用网易的镜像站。 cd /etc/yum.repo.d/ http://mirrors.sohu.com/help/CentOS-Base-sohu.repo && mv CentOS-Base-sohu.repo rhel-source.repo #编辑CentOS6-Base-sohu.repo 文件,把文件里面的$releasever全部替换为版本号,这个地方是版本6 ,最后保存退出。如下: sed -i "s/\$releasever/6.4/g" /etc/yum.repo.d/rhel-source.repo #5.测试是否安装好 yum clean all yum makecache
标签:yum
原文地址:http://shocking119.blog.51cto.com/12454227/1924136