0%

Centos 7 配置本地yum源

创建挂载路径

1
sudo mkdir /mnt/iso

挂载ISO镜像到目录

1
2
3
4
sudo mount -o loop CentOS-7-x86_64-DVD-2003.iso /mnt/iso

系统提示: mount /dev/sr0 is write-protected, mounting read-only 则表示挂载成功

下载地址:

1
2
3
4
5
6
7
8
9
10
11
12
http://mirrors.huaweicloud.com/centos/7.8.2003/isos/x86_64/
http://mirrors.cn99.com/centos/7.8.2003/isos/x86_64/
http://mirrors.tuna.tsinghua.edu.cn/centos/7.8.2003/isos/x86_64/
http://ftp.sjtu.edu.cn/centos/7.8.2003/isos/x86_64/
http://mirrors.163.com/centos/7.8.2003/isos/x86_64/
http://mirrors.neusoft.edu.cn/centos/7.8.2003/isos/x86_64/
http://mirrors.aliyun.com/centos/7.8.2003/isos/x86_64/
http://mirrors.njupt.edu.cn/centos/7.8.2003/isos/x86_64/
http://mirror.bit.edu.cn/centos/7.8.2003/isos/x86_64/
http://mirrors.bfsu.edu.cn/centos/7.8.2003/isos/x86_64/
http://mirrors.nju.edu.cn/centos/7.8.2003/isos/x86_64/
http://mirrors.cqu.edu.cn/CentOS/7.8.2003/isos/x86_64/

验证挂载

1
df -h

创建本地yum源配置文件

1
2
3
4
5
6
7
8
9
sudo touch /etc/yum.repos.d/local.repo

编辑local.repo文件内容

[local_server]
name=Thisis a local repo
baseurl=file:///mnt/iso
enabled=1 #启用yum源,0为不启用,1为启用
gpgcheck=0 #检查GPG-KEY,0为不检查,1为检查

更新yum源

1
2
yum clean all 
yum makecache