Linux 本地yum搭建
作者:互联网
#!/bin/bash
. /etc/init.d/functions
# 定义ISO镜像位置
IsoPath=/root/CentOS-7-x86_64-DVD-1708.iso
Time=$(date +%F).bak
Yum(){
# 挂载镜像
mkdir /mnt/centos
mount ${IsoPath} /mnt/centos
# 备份
(mkdir /etc/yum.repos.d/${Time}
mv /etc/yum.repos.d/* /etc/yum.repos.d/${Time})
# 添加repo文件
cat >> /etc/yum.repos.d/localhost.repo <<EOF
[localhost]
name=localhost
baseurl=file:///mnt/centos
gpgcheck=0
enabled=1
EOF
yum clean all
}
Yum &>/dev/null
if (yum -y install bc-1.06.95-13.el7.x86_64 &>/dev/null);then
action "Yum:"
else
action "Yum:" false
fi
标签:centos,repos,Time,etc,Yum,Linux,yum,搭建 来源: https://www.cnblogs.com/qinziteng/p/16319648.html