CentOS7修改默认yum源为阿里云yum源
1、先确保可以运行wget命令,若不可以运行wget命令,先用默认yum源安装wget工具:yum install -y wget
2、备份系统默认yum源:
[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
3、下载阿里云yum源,这里下载的是centos7:
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
4、生成缓存:
[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
5、完成修改yum源
注意事项:若新手刚完成centos的安装可能没有wget工具包,此时要是直接备份yum源会报错:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
There are no enabled repos.
Run “yum repolist all” to see the repos you have.
You can enable repos with yum-config-manager —enable
还没有评论,来说两句吧...