Centos7 搭建本地yum源方法

2025-11-05 17:51:53

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源方法

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢