一,下载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即可

使用sohu的网络yum源操作步骤_配置文件

使用sohu的网络yum源操作步骤_requested_02

然后执行

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

使用sohu的网络yum源操作步骤_error_03

问题解决