$ cd /etc/yum.repos.d #進入 $ mv CentOS-Base.repo CentOS-Base.repo.back #備份 $ vi CentOS-Base.repo [base] name=CentOS-$releasever - Base baseurl=http://mirrors.aliyun.com/centos/7/os/x86_64/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
2、清除YUM快取
$ sudo yum clean all $ sudo yum makecache
參考文件:https://blog.csdn.net/qq_36973540/article/details/140261982