脚本下载centos
#bin/env bash #date:2020-08-02 #name:repo.sh iso=/dev/cdrom read -p "请输入要建立的yum名称:" yum if [[ -z "$yum" ]];then #echo -e "\033[33m没有任何输入,请输入\033[0m" read -p "请输入要建立的yum名称:" yum [[ -z "$yum" ]] && echo -e "\033[31m没有输入,请重试!\033[0m" && exit fi mkdir -p /mnt/cdrom mount $iso /mnt/cdrom &> /dev/null if [[ $? -eq 0 ]];then echo -e "\033[31m镜像没有链接,请先链接\033[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 "\033[32m本地yum源配置成功\033[0m"