一键自动化配置光盘yum源(要求能上网)

声明

作者:昨夜星辰

博客:http://yestreenstars.blog.51cto.com/

本文由本人创作,如需转载,请注明出处,谢谢合作!

目的

一键自动化配置光盘yum源。

环境

OS:CentOS 6.2 32

配置

#!/bin/bash

echo "First, make sure that you had mounted the cdrom to the /mnt directory."
read -p "Press y/Y to continue." answer
[[ $answer =~ [yY] ]] || exit

(
mkdir -p /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/
yum -y install yum-utils
yum-config-manager --add-repo file:///mnt/
) > /dev/null 2>&1 && echo "OK! You can install by the cdrom now."

备注

这种方式仅适用于能上网的主机,因为需要先用yum下载yum-utils。

你可能感兴趣的:(配置,自动化,一键,yum源)