红联Linux门户
Linux帮助

redhat换yum源

发布时间:2015-08-25 09:49:35来源:linux网站作者:sangbiao

根据redhat操作系统版本及位数,下载对应centos的版本及位数的这些包:
yum-3.2.22-40.el5.centos.noarch.rpm
yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
yum-metadata-parser-1.1.2-4.el5.x86_64.rpm


1.先安装yum-metadata-parser-1.1.2-4.el5.x86_64.rpm:
rpm -ivh yum-metadata-parser-1.1.2-4.el5.x86_64.rpm


2.同时安装yum-3.2.22-40.el5.centos.noarch.rpm、yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
rpm -ivh yum-3.2.22-40.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm


3.获取163yum:
wget http://mirrors.163.com/.help/CentOS-Base-163.repo
文件内容替换:
把CentOS-Base-163.repo文件中的 “$releasever”,替换成“5”(5为系统的版本号。)
vi CentOS-Base-163.repo
:% s/\$releasever/5/g

[base]  

name=CentOS-$releasever - Base  

baseurl=http://mirrors.163.com/centos/6.3/os/$basearch/  

gpgcheck=1  

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6  

#released updates  

[updates]  

name=CentOS-$releasever - Updates  

baseurl=http://mirrors.163.com/centos/6.3/updates/$basearch/  

gpgcheck=1  

gpgkey=http://mirrors.163.com/centos/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/$releasever/addons/$basearch/  

#gpgcheck=1  

#gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6  

#additional packages that may be useful  

[extras]  

name=CentOS-$releasever - Extras  

baseurl=http://mirrors.163.com/centos/6.3/extras/$basearch/  

gpgcheck=1  

gpgkey=http://mirrors.163.com/centos/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.3/centosplus/$basearch/  

gpgcheck=1  

enabled=0


更新yum源/apt-get源:http://www.linuxdiyf.com/linux/13136.html

RedHat Enterprise Linux 5.4用CentOS 5.5 yum源替换:http://www.linuxdiyf.com/linux/8919.html

Fedora更新源(sohu yum源):http://www.linuxdiyf.com/linux/11638.html

RHEL5.x&RHEL6.x更换CentOS yum源:http://www.linuxdiyf.com/linux/8248.html

RHEL5如何使用CentOS更新yum源:http://www.linuxdiyf.com/linux/5745.html