Linux8.2--配置本地YUM源
配置Yum源
// 首先挂载镜像
mount /dev/sr0 /mnt 把本地镜像挂载到mnt目录下
// 跳转到此目录
cd /etc/yum.repos.d/
// 创建文件
mkdir dvd.repo #后缀必须是.repo格式
// 在此文件中进行写yum源
vim dvd.repo
[dvd]
name=dvd
baseurl=file:///mnt/BaseOS
gpgcheck=0
enabled=1
[dvd2]
name=dvd2
baseurl=file:///mnt/AppStream
gpgcheck=0
enabled=1
//
清理yum源
yum clean all
列出仓库里的所有软件包
yum list all
[rhel-media] :Yum软件仓库唯一标识符,避免与其他仓库冲突。
name=linuxprobe:Yum软件仓库的名称描述,易于识别仓库用处。
baseurl=file:///media/cdrom:提供的方式包括FTP(ftp://…)、HTTP(http://…)、本地(file:///…)。
enabled=1:设置此源是否可用;1为可用,0为禁用。
gpgcheck=1:设置此源是否校验文件;1为校验,0为不校验。
gpgkey=file:///media/cdrom/RPM-GPG-KEY-redhat-release:若上面参数开启校验,那么请指定公钥文件地址。
报错:在配置YUM源时,报错找不到YUM源
可以参考此
- Curl error (37): Couldn’t read a file:// file for file:///media/cdrom/repodata/repomd.xml [Couldn’t open file /media/cdrom/repodata/repomd.xml]
Error: Failed to download metadata for repo ‘c’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
上面的报错意思就是说yum启动用到了repomd.xml这个文件,但是系统没有找到,而且系统找的路径是:/mnt/repodata/repomd.xml
既然说是文件不存在,那我们就寻找这个文件的位置,命令测试:
find /mnt/ -name repomd.xml
显示该文件的位置是:
/mnt/AppStream/repodata/repomd.xml
/mnt/BaseOS/repodata/repomd.xml
而我设置的dvd.repo位置:
baseurl=file:///mnt/
修改为
baseurl=file:///mnt/BaseOS
问题解决,本地yum可以使用
参考:https://www.likecs.com/show-204253083.html