CentOS7本地yum配置脚本

  • A+
所属分类:linux技术
摘要

脚本下载


CentOS7本地yum配置脚本

脚本下载

#bin/env bash #date:2020-08-02 #name:repo.sh iso=/dev/cdrom read -p "请输入要创建的yum名称:" yum  if [[ -z "$yum" ]];then     #echo -e "33[33m没有任何输入,请输入33[0m"     read -p "请输入要创建的yum名称:" yum     [[ -z "$yum" ]] && echo -e "33[31m没有输入,请重试!33[0m" && exit      fi   mkdir -p /mnt/cdrom mount $iso /mnt/cdrom &> /dev/null if [[ $? -eq 0 ]];then     echo -e "33[31m镜像没有连接,请先连接33[0m"     exit fi  echo "mount $iso /mnt/cdrom" >>/etc/rc.local  tee >> /etc/yum.repos.d/"$yum".repo<<-eof [$yum] name=$yum baseurl=file:///mnt/cdrom gpgcheck=0 enable=1 eof  yum clean all &> /dev/null echo -e "33[32m本地yum源配置成功33[0m"