配置yum源并安装dhcp脚本

Posted fzlsss

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了配置yum源并安装dhcp脚本相关的知识,希望对你有一定的参考价值。

执行前提是:
关闭防火墙和selinux
配置好本机IP
配置本地原iso镜像文件
vim /etc/fstab写入:
/dev/cdrom /mnt/cdrom iso9660 defaults loop 0 0


以下是脚本内容:
#!/bin/sh
echo "
  1. install dhcp
  2. configer dhcp
  "

echo "Please input you choice:"
read shu

if [ $shu -eq 1 ]; then
  mkdir /mnt/cdrom
  rm -rf /etc/yum.repos.d/*
  cd /etc/yum.repos.d

touch my.repo
echo "[my_repo]" > /etc/yum.repos.d/my.repo
echo "name=my local repo" >> /etc/yum.repos.d/my.repo
echo "baseurl=file:///mnt/cdrom" >> /etc/yum.repos.d/my.repo
echo "enabled=1" >> /etc/yum.repos.d/my.repo
echo "gpgchech=0" >> /etc/yum.repos.d/my.repo

mount /dev/cdrom /mnt/cdrom -o loop
yum install dhcp -y

elif [ $shu -eq 2 ];then
  echo "please input your subnet:"
read subnet
echo "please input you netmask"
read netmask
echo "subnet $subnet netmask $netmask" >> /etc/dhcp/dhcpd.conf
echo "{" >> /etc/dhcp/dchpd.conf

echo "please input you ip range:"
read range
echo " range $range" >> /etc/dhcp/dhcpd/conf

echo "pkease input your option routers:"
read routers
echo " option routers $routers;" >> /etc/dhcp/dhcpd.conf

echo "default-lease-time:"
read xianzhi
echo "default-lease-time $xianzhi;" >> /etc/dhcp/dhcpd.conf
else
exit
fi

 


































以上是关于配置yum源并安装dhcp脚本的主要内容,如果未能解决你的问题,请参考以下文章

docker探索-CentOS7中配置Docker的yum源并升级安装docker1.13

ProxmoxVE(PVE) 7配置国内软件源并删除订阅弹窗

centos 搭建本地YUM源并使用apache共享YUM源

redhat7配置阿里云的yum源并安装httpd服务  

DHCP安装脚本

Shell ❀ Linux系统自动挂载本地yum源并安装rpm依赖包