centos重灌或者切換yum源配置
阿新 • • 發佈:2020-09-01
CentOS7系統配置國內yum源和epel源
源文章地址:https://www.cnblogs.com/renpingsheng/p/7845096.html
1.首先進入/etc/yum.repos.d/
目錄下,新建一個repo_bak目錄,用於儲存系統中原來的repo檔案
[root@bogon ~]# cd /etc/yum.repos.d/
[root@bogon yum.repos.d]# mkdir repo_bak
[root@bogon yum.repos.d]# mv *.repo repo_bak/
2.在CentOS中配置使用網易和阿里的開源映象
到網易和阿里開源映象站點下載系統對應版本的repo檔案
[root@bogon yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
[root@bogon yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@bogon yum.repos.d]# ls
Centos-7.repo CentOS-Base-163.repo repo.bak
或者手動下載repo檔案並上傳到/etc/yum.repos.d/
目錄
3.清除系統yum快取並生成新的yum快取
[root@bogon yum.repos.d]# ls # 列出/etc/yum.repos.d/目錄下的檔案
Centos-7.repo CentOS-Base-163.repo repo.bak
[root@bogon yum.repos.d]# yum clean all # 清除系統所有的yum快取
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Cleaning repos: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[root@bogon yum.repos.d]# yum makecache # 生成yum快取
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/12): base/7/x86_64/filelists_db | 6.7 MB 00:00:02
(2/12): base/7/x86_64/group_gz | 156 kB 00:00:02
(3/12): base/7/x86_64/other_db | 2.5 MB 00:00:01
(4/12): base/7/x86_64/primary_db | 5.7 MB 00:00:02
(5/12): extras/7/x86_64/prestodelta | 51 kB 00:00:01
(6/12): extras/7/x86_64/filelists_db | 494 kB 00:00:02
(7/12): extras/7/x86_64/other_db | 86 kB 00:00:00
(8/12): extras/7/x86_64/primary_db | 130 kB 00:00:01
(9/12): updates/7/x86_64/prestodelta | 406 kB 00:00