一,下載yum的repo文件:
yum -y install wget
cd /etc/yum.repos.d/
wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
二,將其他的配置文件改名設置備份
mv CentOS-Base.repo CentOS-Base.repo.bak
三,測試yum源可用性
yum list | wc -l
顯示5313個包即爲配置正確
配置sohu的網絡yum源常見報錯:
一,路徑錯誤:
[root@localhost ~]# yum list | wc -l
http://mirrors.sohu.com/centos/6/addons/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://ftp.jaist.ac.jp/pub/Linux/CentOS/6/addons/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
解析:
此爲配置路徑錯誤
解決辦法:
cd /etc/yum.repos.d/
vim CentOS-Base-sohu.repo
找到addons修改爲os即可
然後執行
yum makecache
問題解決。
二,進程佔用
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Existing lock /var/run/yum.pid: another copy is running as pid 1224.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 14 M RSS (142 MB VSZ)
Started: Tue Jul 19 19:41:24 2016 - 00:12 ago
State : Traced/Stopped, pid: 1224
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 14 M RSS (142 MB VSZ)
Started: Tue Jul 19 19:41:24 2016 - 00:14 ago
State : Traced/Stopped, pid: 1224
^Z
解決辦法:
使用kill -9 強制殺死對應進程
kill -9 1224
問題解決