yum是centos下更新、管理软件的命令,也有相应的图像界面版本;
yum源是yum命令去哪里取安装包的地图;
yum命令查询repo上配置的地址去取相应的rpm包进行安装;
[sourcecode language="plain"]
[root@localhost ~]# uname -r
3.10.0-693.el7.x86_64
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
[/sourcecode]
1、备份系统原来的yum源
[sourcecode language="plain"]
[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
[/sourcecode]
2、下载阿里云的CentOS-Base.repo 到/etc/yum.repos.d/ {#2、下载阿里云的CentOS-Base-repo-到-etc-yum-repos-d}
[sourcecode language="plain"]
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[/sourcecode]
3、添加阿里云公共DNS {#3、添加阿里云公共DNS}
为了防止不能寻找yun源地址,生成cache,先添加阿里云的DNS
[sourcecode language="plain"]
[root@localhost ~]# vim /etc/resolv.conf
添加
nameserver 223.5.5.5
nameserver 223.6.6.6
[/sourcecode]
4、清理缓存,并生成新缓存 {#4、清理缓存}
[sourcecode language="plain"]
[root@localhost ~]# yum clean all && yum makecache
[/sourcecode]