1)先安裝wget
執行命令 yum install -y wget
[root@localhost ~]# yum install -y wget
1
查詢國內鏡像源
打開阿里鏡像http://mirrors.aliyun.com/
這里寫圖片描述
點擊幫助:
這里寫圖片描述
3)下載CentOS 7的repo文件
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
1
2
3
4)更新鏡像源
#清除緩存
yum clean all
#生成緩存
yum makecache
1
2
3
4
[root@localhost ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[root@localhost ~]# yum makecache
Loaded plugins: fastestmirror
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/group_gz | 155 kB 00:00:00
(2/12): extras/7/x86_64/filelists_db | 770 kB 00:00:02
(3/12): extras/7/x86_64/primary_db | 151 kB 00:00:00
(4/12): extras/7/x86_64/other_db | 640 kB 00:00:07
(5/12): updates/7/x86_64/filelists_db
.......省略
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
大痴小乙
關注
————————————————
版權聲明:本文為CSDN博主「大痴小乙」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/fxbin123/article/details/80072793