Centos系統配置虛擬機網絡yum源
1、這是中科大的源
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.save //先重命名Centos自帶的yum源。
wget http://mirrors.ustc.edu.cn/centos/CentOS-Base.5.mirrors.repo O /etc/yum.repos.d/CentOS-Base.repo
yum makecache
2、這是sohu的源
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.save //先重命名Centos自帶的yum源。
wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
yum makecache
3、阿里雲Linux安裝鏡像源地址:http://mirrors.aliyun.com/
第一步:備份原鏡像文件,以免出錯後可以恢復。
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
第二步:下載新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
第三步:運行yum makecache生成緩存
yum makecache
更改後
[root@xinsz63 yum.repos.d]# ls
CentOS-Base.repo
有時候會出現錯誤,現象:
Loading "installonlyn" plugin
Existing lock /var/run/yum.pid: another copy is running. Aborting.
這是因爲yum在更新, 此時是kill不掉的該進程的, 正確的解決方法是讓它停止更新即可。
可以直接輸入 rm -f /var/run/yum.pid
也可以/etc/init.d/yum-updatesd stop