Centos7 搭建本地yum源方法

时间:2026-02-12 21:45:47

1、系统还是CentOS 7

Centos7 搭建本地yum源方法

2、准备好镜像文件CentOS-7-x86_64-DVD-1908.iso

Centos7 搭建本地yum源方法

3、挂载iso文件到/mnt目录

mount -o loop CentOS-7-x86_64-DVD-1908.iso  /mnt/

Centos7 搭建本地yum源方法

4、备份原yum源配置

mv /etc/yum.repos.d /etc/yum.repos.d.bak

Centos7 搭建本地yum源方法

5、创建新的目录和yum源

mkdir /etc/yum.repos.d

vi /etc/yum.repos.d/CentOS-local.repo

Centos7 搭建本地yum源方法

6、                               

[root@localhost mnt]# vi /etc/yum.repos.d/CentOS-local.repo

#本源的名字(不能和其他重复)

[base-local]

name=CentOS7.7-local

#步骤2中挂载镜像创建的目录

baseurl=file:///mnt

#启动yum源: 1-启用 0-不启用

enabled=1

#安全检测:  1-开启 0-不开启

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

~                                                    

Centos7 搭建本地yum源方法

7、更新yum源配置

yum clean all 

yum makecache

Centos7 搭建本地yum源方法

8、安装软件成功

Centos7 搭建本地yum源方法

© 2026 五度知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com