上传镜像文件到/mnt文件夹下,或者上传到其他文件夹下
挂载镜像路径/mnt/cdrom
在mnt文件夹下创建cdrom文件夹
创建命令:mkdir cdrom
挂载镜像命令:mount rhel-server-7.6-x86_64-dvd.iso cdrom
配置yum文件:vim /etc/yum.repos.d/rhel-source.repo
配置内容:
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-source-beta]
name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
清除yum缓存:yum clean all
就可以从镜像里下载你所需要的东西了
卸载镜像:umount /mnt/cdrom