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下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native