zoukankan      html  css  js  c++  java
  • cobbler脚本

    #!/bin/bash
    setenforce 0
    sed -i 's/=enforcing/=disabled/g' /etc/selinux/config
    systemctl start firewalld
    systemctl enable firewalld

    rm -rf /etc/yum.repos.d/*.repo
    echo "[base]
    name=base
    baseurl=http://192.168.10.8/base
    enabled=1
    gpgcheck=0

    [adv]
    name=adv
    baseurl=http://192.168.10.8/adv
    enabled=1
    gpgcheck=0

    [cob]
    name=cob
    baseurl=http://192.168.10.8/cobbler
    enabled=1
    gpgcheck=0" > /etc/yum.repos.d/iso.repo

    yum install cobbler dhcp tftp-server xinetd syslinux httpd pykickstart -y

    IP=`ifconfig |grep broad|grep -w inet |awk '{print $2}'`
    WD=`echo $IP |awk -F. '{print $1"."$2"."$3}'`

    echo "subnet $WD.0 netmask 255.255.255.0 {
    range $WD.150 $WD.200;
    default-lease-time 600;
    max-lease-time 7200;
    filename "pxelinux.0";
    }" > /etc/dhcp/dhcpd.conf


    systemctl enable dhcpd
    systemctl restart dhcpd

    sed -i '14s/yes/no/g' /etc/xinetd.d/tftp
    systemctl enable xinetd
    systemctl restart xinetd

    systemctl enable httpd cobblerd
    systemctl restart httpd cobblerd

    cobbler check
    sed -i "/^server:/{s/127.0.0.1/$IP/g}" /etc/cobbler/settings"  
    sed -i "/^next_server:/{s/127.0.0.1/$IP/g}" /etc/cobbler/settings

    systemctl enable rsyncd
    systemctl restart rsyncd


    sed -i '101s/"$1$mF86/UHC$WvcIcX2t6crBz2onWxyac."/"$1$123$7mft0jKnzzvAdU4t0unTG1"/g' /etc/cobbler/settings

    systemctl restart cobblerd
    cobbler sync

    mount /dev/cdrom /mnt
    cobbler import --path=/mnt --name="centos7"

    cobbler distro list
    cobbler profile list
    mv /root/anaconda-ks.cfg /var/lib/cobbler/kickstarts/ks.cfg

    sed -i '1,10s/cdrom//g' /var/lib/cobbler/kickstarts/ks.cfg
    sed -i 10a"url --url=http://$IP/cobbler/ks_mirror/centos7/" /var/lib/cobbler/kickstarts/ks.cfg

    cobbler profile add --distro=centos7-x86_64 --name=centos7_zxw --kickstart=/var/lib/cobbler/kickstarts/ks.cfg
    cobbler sync
    cobbler profile list
    cobbler profile remove --name=centos7-x86_64

    firewall-cmd --add-port=67/udp --permanent
    firewall-cmd --add-port=69/udp --permanent
    firewall-cmd --add-port=80/tcp --permanent
    firewall-cmd --add-port=25151/tcp --permanent
    firewall-cmd --reload

  • 相关阅读:
    javaBean实体包区分
    先后天八卦配太极图
    mysql表连接
    关于解决问题方法论的思考
    Python基础综合练习
    大数据概述
    编译原理
    词法分析
    组合数据类型练习
    词法分析器实验报告
  • 原文地址:https://www.cnblogs.com/itzhao/p/11322879.html
Copyright © 2011-2022 走看看