redhat换yum源

时间:2024-10-06 10:36:20
根据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:
文件内容替换:
 把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