Get the App
SLTechnology News&Howtos  ›  Servers  › 

What is the automatic installation and configuration of cobbler based on centos7 series

Shulou Source: shulou.com Published: 2022-06-01 07:22:16 10月03日 Update

This article to share with you is based on centos7 series cobbler automatic installation configuration is how, Xiaobian think quite practical, so share to everyone to learn, I hope you can read this article after some harvest, not much to say, follow Xiaobian to see it.

Centos7.6-based scripts, centos7 should be applicable, execute scripts to maintain normal access to the public network, can use yum installation software normally

Example ks configuration file centos7.6ks.cfg clears disk sda's mbr and all partitions by default. Note that

According to ks configuration template, add and delete software packages, adjust partition size, add custom commands, etc.

#!/ bin/bash#====================================================# Author: Mr.Song# Create Date: 2019-10-11# Description: auto install config cobbler#====================================================###########################################wanning!!!! ks config file default clear sda mbr and all partition!!!!!# wanning!!!! ks config file default clear sda mbr and all partition!!!!!# wanning!!!! ks config file default clear sda mbr and all partition!!!!!########################################### cobbler web url:https://SERVER_IP/cobbler_web#cobbler web user/pass:cobbler/cobblerset -x systemctl stop firewalld&& systemctl disable firewalldsetenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinuxyum install -y epel-release ||'echo "install epel yum error,please check network or yum config" &&exit 1'yum -y install cobbler dhcp httpd xinetd tftp-server syslinux pykickstart rsync cobbler-web debmirror pykickstart fence-agents || 'echo "install cobbler error,please check network or yum config" &&exit 1'systemctl restart httpd xinetd rsyncd && systemctl enable httpd xinetd rsyncd dhcpdSERVER_IP=`ifconfig | grep broadcast | grep -v 172 | awk -F" " '{print $2}'`SERVER_NET_ADDR=`echo $SERVER_IP | awk -F". " '{print $1,$2,$3}'|sed 's/[[:space:]]/./ g'`sed -ri "s/^(manage_dhcp: ).*/\ 11/" /etc/cobbler/settingssed -ri "s/^(next_server: ).*/\ 1$SERVER_IP/" /etc/cobbler/settingssed -ri "s/^(server: ).*/\ 1$SERVER_IP/" /etc/cobbler/settingssed -ri "/disable/s/yes/no/" /etc/xinetd.d/tftpsed -ri "s#192.168.1#$SERVER_NET_ADDR#g;/option routers/s#192.168.10.5#$SERVER_IP#;/option domain-name-servers/s#192.168.10.1#$SERVER_IP#;/next-server/s#\$next_server#$SERVER_IP#" /etc/cobbler/dhcp.template#COBBLER_PASS=`openssl passwd -1 -salt 'test' '111111'`#sed -ri "s/^(default_password_crypted: ).*/\ 1"$COBBLER_PASS"/" /etc/cobbler/settingssystemctl enable cobblerd && systemctl restart cobblerd if [ $? -ne 0 ];then echo "cobbler service error,please check log error" exit 1fisleep 3cobbler get-loaders ||'echo "get sample file fail,please check config"&&exit 1'sed -i '/@dists="sid";/s/^/#/;/@arches="i386";/s/^/#/' /etc/debmirror.confcobbler syncsystemctl restart cobblerd cat > /var/lib/cobbler/kickstarts/centos7.6ks.cfg

Tags: Configuration more knowledge articles scripts software utility premises commands size that is work sessions files articles templates look knowledge points disks examples industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Apple OPPO Reno MySQL Microsoft