centos8自动化安装脚本写在哪里

centos8自动化安装脚本写在哪里,第1张

centos8文件夹。

1、打开电脑页面上的此电脑。

2、点击本地优盘。

3、搜迟知带索centos8,然码芦后在centos8自动化安猛桐装脚本写在最下边就可以。

1、自动完成安装,基本配置

2、通过提示输入网段、子网掩码、网关、DNS、IP起止地址等信息完成作用域的添加

【方法一】:

#!/bin/bash

conf="/etc/dhcpd.conf"带族

rpm -q dhcp &>/dev/null

if [ $? -ne 0 ]then

yum -y install dhcp

fi

grep "subnet" $conf &>/dev/null

if [ $? -ne 0 ]then

echo "

ddns-update-style interim

ignore client-updates

default-lease-time 21600

max-lease-time 43200

" >$conf

fi

read -p "please input network:" network

read -p "please input netmask:" netmask

read -p "please input gateway:" gateway

read -p "please input DNS:" dns

read -p "please input start_ip:" start_ip

read -p "please input end_ip:" end_ip

echo "

subnet $network netmask $netmask {

option routers $gateway

option subnet-mask $netmask

URL地址:枯蔽

option domain-name-servers $dns

range dynamic-bootp $start_ip $end_ip

}

" >>$conf

service dhcpd restart

【方法二】:

#!/蠢败弊bin/bash

dhcpconf=/etc/dhcpd.conf

rpm -q dhcp &>/dev/null

if [ $? -ne 0 ]then

yum -y install dhcp

fi

grep "subnet" $dhcpconf &>/dev/null

if [ $? -ne 0 ]then

echo "ddns-update-style interim

ignore client-updates

default-lease-time 21600

max-lease-time 43200" >$dhcpconf

fi

while true

do

read -p "please input Network:" network

read -p "please input Netmask:" netmask

read -p "please input Gateway:" gateway

read -p "please input DNS:" dns

read -p "please input Start_IP:" start_ip

read -p "please input End_IP:" end_ip

grep $network $dhcpconf &>/dev/null

if [ $? -ne 0 ]then

echo "subnet $network netmask $netmask {

option routers $gateway

option subnet-mask $netmask

option domain-name-servers $dns

range dynamic-bootp $start_ip $end_ip

}" >>$dhcpconf

read -p "continue to do (yes/no)?" yn

if [ $yn = "no" ]then

service dhcpd status &>/dev/null

if [ $? -ne 0 ]then

service dhcpd start &>/dev/null

else

service dhcpd reload &>/dev/null

fi

exit 0

fi

fi

done


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/tougao/12508416.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2025-08-25
下一篇2025-08-25

发表评论

登录后才能评论

评论列表(0条)

    保存