因为自己用刚VM安装的centos 7,使用yum安装程序的时候,发现一个程序都找不到,
我猜测可能是国外的yum源被限制了,然后换成国内的阿里yum源,就可以安装了。

一、备份

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
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

三、运行yum makecache生成缓存

一句句执行

yum clean all 
yum makecache
yum update

如果需要下载第三方软件;那么就得安装一个第三方软件库epel

wget  -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

然后就可以用来安装程序了。