基于ISO镜像制作本地yum源

基于ISO镜像制作本地yum源

在工作中很多情况下,操作系统环境可能是最小化的系统环境,而且无法连接到互联网。在遇到此类情况中,可以将操作系统ISO文件上传到操作系统,搭建一个建议的本地yum源,用于使用yum命令快速安装部分软件。本文以centos 7.9为例,进行简单讲解,reahat系列的操作系统均大同小异。

一、准备镜像文件

OracleLinux-Release7-Update6-x86_64-dvd.iso上传至某个目录,以/opt为例。

cd /opt
mkdir -p /media/centos7.9
mount -o loop -t iso9660 /opt/OracleLinux-Release7-Update6-x86_64-dvd.iso /media/centos7.9

二、配置yum.repo

  • 配置
cd /etc/yum.repos.d
touch local.repo
cat >> local.repo < EOF
[base]
name=RedHat
baseurl=file:///media/centos7.9
enabled=1
gpgckeck=0
gpgkey=file:///media/centos7.9/RPM-GPG-KEY-CentOS-7
EOF
  • 测试
yum clean all
yum install -y tree

猜你喜欢

转载自blog.csdn.net/m0_38004228/article/details/129323935