Centos7中搭建本地yum源

版权声明:转载请注明出处 https://blog.csdn.net/C1041067258/article/details/83375137

电脑无法连接外网,搭建个本地yum源服务器

a> 下载镜像进行上传

http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Everything-1804.iso

b> 将iso文件上传,(假设上传到/data目录下)

# mkdir -p /data/iso

文件上传工具可以使用 (FileZillaPortable),选择一款自己经常使用的工具上传即可

c> 挂载镜像(此处挂载到/data/iso下面,注意别与上传路径弄混)

# cd /data
# mount -o loop -t iso9660 CentOS-7-x86_64-Everything-1511.iso /data/iso

d> 本地yum文件配置(把原来的配置文件放到备份目录,新建本地yum配置文件local.repo)

# cd /etc/yum.repos.d/
# mkdir bak
# mv *.repo bak/
# vim local.repo

e> local.repo文件内容如下

[iso] 
name=CentOS-7-x86_64-Everything-iso 
baseurl=file:///data/iso 
gpgcheck=0 
enabled=1

f > 清除缓存,进行验证

# yum clean all
# yum makecache

----如有错误,欢迎指正

猜你喜欢

转载自blog.csdn.net/C1041067258/article/details/83375137