centos7基于光驱搭建本地yum源

2019-11-20  本文已影响0人  东南猫

1.挂载光驱并拷贝数据到指定目录/yumserver

[root@localhost mnt]# mount -t iso9660 /dev/cdrom /mnt/

mount: /dev/sr0 is write-protected, mounting read-only

[root@localhost mnt]# mkdir -p /yumserver

[root@localhost mnt]# cp -a /mnt/* /yumserver/

2.创建repo文件

[root@localhost yum.repos.d]# cd /etc/yum.repos.d

[root@localhost yum.repos.d]# mkdir -p bak

[root@localhost yum.repos.d]# cp *.repo ./bak

[root@localhost yum.repos.d]# cat cdrom.repo   ##vim 去创建repo文件

[cdrom]

name=CentOS7 - cdrom

baseurl=file:///yumserver/

enable=1

gpgcheck=0

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

3.验证yum源清单

[root@localhost yum.repos.d]# yum repolist

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

repo id                                                            repo name                                                                    status

cdrom                                                              CentOS7 - cdrom                                                              4,021

repolist: 4,021

[root@localhost yum.repos.d]#

上一篇 下一篇

猜你喜欢

热点阅读