• 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

  • 相关阅读:
    安装图形化界面
    cemtos安装python
    traceback说明
    python常用魔法函数
    python上传文件接口
    文件上传接口
    MongoDB安装与使用
    解决macOS系统向有跳板机的服务器传文件
    mac终端命令sftp
    linux下mysql服务安装
  • 原文地址:https://www.cnblogs.com/itzhao/p/11322879.html
Copyright © 2020-2023  润新知