kickstart一键安装

本文介绍了如何利用kickstart文件实现Linux系统的全自动安装,通过定制安装配置,简化部署流程,提高效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

注意脚本中的ip需要修改!#bin/bash##by syaving#date 2016-11-09#pxe install OS#Linux for CentOS-6.8 2.6.32-642.el6.x86_64. /etc/init.d/functionsfor rpm in dhcp tftp tftp-server xinetd syslinux httpddorpm -qa | grep $rpm >/dev/null 2>&1if [[ $? == 0  ]];thenechoecho -e "Package [$rpm] is already installed. "elseechoecho -e "Start to install package [$rpm]."yum install -y $rpm >/dev/null 2>&1rpm -qa | grep $rpm >/dev/null 2>&1    if [[ $?==0 ]];then  echo  echo -e "Install package [$rpm] SUCCESSFULLY."  else  echo   echo -e "Install package [$rpm] FAILED."  fifidonesleep 5/bin/cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bakcat >/etc/dhcp/dhcpd.conf<<eof# DHCP Server Configuration file.#   see /usr/share/doc/dhcp*/dhcpd.conf.sample# by Syavingsubnet 172.16.1.0 netmask 255.255.255.0 {        range 172.16.1.100 172.16.1.200;        option subnet-mask 255.255.255.0;        default-lease-time 21600;        max-lease-time 43200;        next-server 172.16.1.100;     #注意要修改        filename "/pxelinux.0";}eof/etc/init.d/dhcpd start >>/dev/null 2>&1if [ $? -eq 0 ];then    action "dhcp" /bin/trueelse    action "dhcp" /bin/falsefisleep 6/bin/cp /etc/xinetd.d/tftp /etc/xinetd.d/tftp.bakcat >/etc/xinetd.d/tftp<<eof# default: off# description: The tftp server serves files using the trivial file transfer \#       protocol.  The tftp protocol is often used to boot diskless \#       workstations, download configuration files to network-aware printers, \#       and to start the installation process for some operating systems.service tftp{        socket_type             = dgram        protocol               = udp        wait                  = yes        user                  = root        server                = /usr/sbin/in.tftpd        server_args             = -s /var/lib/tftpboot         disable                = no         per_source              = 11        cps                  = 100 2        flags                 = IPv4}eof/etc/init.d/xinetd start >>/dev/null 2>&1if [ $? -eq 0 ];then    action "tftp" /bin/trueelse    action "tftp" /bin/falsefisleep 6sed -i "277i ServerName 127.0.0.1:80" /etc/httpd/conf/httpd.conf/etc/init.d/httpd start >>/dev/null 2>&1/bin/mkdir -p /var/www/html/CentOS-6.8###/bin/mount -o loop -t iso9660 /dev/cdrom /var/www/html/CentOS-6.8/if [ $? -eq 0 ];then    action "http" /bin/trueelse    action "http" /bin/falsefisleep 6/bin/cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot//bin/cp -a /var/www/html/CentOS-6.8/isolinux/* /var/lib/tftpboot//bin/mkdir -p /var/lib/tftpboot/pxelinux.cfgif [ $? -eq 0 ];then    action "syslinux" /bin/trueelse    action "syslinux" /bin/falsefisleep 6#ks.conf/bin/mkdir /var/www/html/ks_configks_xxx="/var/www/html/ks_config"/bin/cp /server/scripts/CentOS-6.8-ks.cfg $ks_xxx#/bin/cp /server/scripts/optimization.sh $ks_xxxcat >/var/lib/tftpboot/pxelinux.cfg/default<<eofdefault ksprompt 0label ks  kernel vmlinuz  append initrd=initrd.img ks=http://172.16.1.100/ks_config/CentOS-6.8-ks.cfg ksdevice=eth1eof

本文出自 “宋某人c” 博客,请务必保留此出处http://syaving.blog.51cto.com/5614476/1863707

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值