linux 安装Centos源

1、删除以前的yum源
rpm-qa|grepyum|xargsrpm-e--nodeps

2、从http://centos.ustc.edu.cn/centos/5.4/os/i386/CentOS/下载以下文件并安装
yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
yum-3.2.22-20.el5.centos.noarch.rpm
yum-updatesd-0.9-2.el5.noarch.rpm
或者找个FTP站点用wget下载:
#wgetftp://ftp.pdc.kth.se/pub/bambi/centos/5.4/os/i386/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
#wgetftp://ftp.pdc.kth.se/pub/bambi/centos/5.4/os/i386/CentOS/yum-3.2.22-20.el5.centos.noarch.rpm
#wgetftp://ftp.pdc.kth.se/pub/bambi/centos/5.4/os/i386/CentOS/yum-updatesd-0.9-2.el5.noarch.rpm

3、#rpm-ivhyum*.rpm

4、cd/etc/yum.repos.d
编辑CentOS-Base.repo,填入以下内容

######################
[base]
name=CentOS-5-Base
repo=os
baseurl=http://centos.ustc.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[update]
name=CentOS-5-Updates
baseurl=http://centos.ustc.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[addons]
name=CentOS-5-Addons
baseurl=http://centos.ustc.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[extras]
name=CentOS-5-Extras
baseurl=http://centos.ustc.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[centosplus]
name=CentOS-5-Plus
baseurl=http://centos.ustc.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[contrib]
name=CentOS-5-Contrib
baseurl=http://centos.ustc.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
###################

5、一个完整的yum源就完成了

你可能感兴趣的:(linux,centos,安装Centos源)