本篇文章給大家分享的是有關(guān)基于centos7系列cobbler自動(dòng)安裝配置是怎樣的,小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
成都一家集口碑和實(shí)力的網(wǎng)站建設(shè)服務(wù)商,擁有專業(yè)的企業(yè)建站團(tuán)隊(duì)和靠譜的建站技術(shù),十多年企業(yè)及個(gè)人網(wǎng)站建設(shè)經(jīng)驗(yàn) ,為成都1000+客戶提供網(wǎng)頁設(shè)計(jì)制作,網(wǎng)站開發(fā),企業(yè)網(wǎng)站制作建設(shè)等服務(wù),包括成都營銷型網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),同時(shí)也為不同行業(yè)的客戶提供網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站設(shè)計(jì)的服務(wù),包括成都電商型網(wǎng)站制作建設(shè),裝修行業(yè)網(wǎng)站制作建設(shè),傳統(tǒng)機(jī)械行業(yè)網(wǎng)站建設(shè),傳統(tǒng)農(nóng)業(yè)行業(yè)網(wǎng)站制作建設(shè)。在成都做網(wǎng)站,選網(wǎng)站制作建設(shè)服務(wù)商就選創(chuàng)新互聯(lián)建站。
基于centos7.6的腳本,centos7應(yīng)該都是適用的,執(zhí)行腳本前提保持能正常訪問公網(wǎng),能正常使用yum安裝軟件
示例ks配置文件centos7.6ks.cfg默認(rèn)清空磁盤sda的mbr以及所有分區(qū),需要注意
可以根據(jù)ks配置模板,自定義添加刪除軟件包,調(diào)整分區(qū)大小,添加自定義命令等
#!/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/cobbler set -x systemctl stop firewalld&& systemctl disable firewalld setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux yum 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 dhcpd SERVER_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/settings sed -ri "s/^(next_server: ).*/\1$SERVER_IP/" /etc/cobbler/settings sed -ri "s/^(server: ).*/\1$SERVER_IP/" /etc/cobbler/settings sed -ri "/disable/s/yes/no/" /etc/xinetd.d/tftp sed -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/settings systemctl enable cobblerd && systemctl restart cobblerd if [ $? -ne 0 ];then echo "cobbler service error,please check log error" exit 1 fi sleep 3 cobbler get-loaders ||'echo "get sample file fail,please check config"&&exit 1' sed -i '/@dists="sid";/s/^/#/;/@arches="i386";/s/^/#/' /etc/debmirror.conf cobbler sync systemctl restart cobblerd cat > /var/lib/cobbler/kickstarts/centos7.6ks.cfg <<- 'EOF' #version=DEVEL # System authorization information auth --enableshadow --passalgo=sha512 # Use CDROM installation media #url --url=http://192.168.10.11/cblr/links/CentOS-7.6-x86_64 url --url=$tree # Use text install text firewall --disabled selinux --disabled # Run the Setup Agent on first boot firstboot --enable ignoredisk --only-use=sda # Keyboard layouts keyboard --vckeymap=us --xlayouts='us' # System language lang en_US.UTF-8 # Network information #network --bootproto=dhcp --device=ens33 --onboot=yes --ipv6=auto --no-activate network --bootproto=dhcp --device=ens33 --onboot=yes network --hostname=localhost.localdomain # Root password #rootpw --iscrypted $6$zXlxIRJdARN9vxNF$2y3Y7g3MkPjIXCEEtP1f9ybId5bTMzhjXAEewgEqdfjv2pagfChjkyzkzXdFWtYwSw6gAgb6VrD3ZF/bQJVRL. rootpw 111111 # System services services --disabled="chronyd" # System timezone timezone Asia/Shanghai --isUtc --nontp # System bootloader configuration bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda #autopart --type=lvm zerombr part /boot/efi --fstype="efi" --ondisk=sda --size=512 --fsoptions="defaults,uid=0,gid=0,umask=0077,shortname=winnt" #part /app --fstype="xfs" --size=1024 part swap --fstype="swap" --size=4096 --ondisk=sda part / --fstype="xfs" --size=1 --grow --ondisk=sda #part /boot --fstype="ext4" --size=500 # Partition clearing information clearpart --all --initlabel #clearpart --none --initlabel #reboot after install system reboot %packages @^minimal @core wget rsync screen dos2unix telnet lrzsz sysstat vim nano gcc chrony bash-completion net-tools psmisc tree dmidecode kexec-tools %end %post #rm -f /etc/yum.repos.d/*.repo #wget $tree #mkdir -p /mnt/iso/centos7.6 #rsync $tree/* /mnt/iso/centos7.6 %end EOF ########################################## #step1 : mount iso #mkdir -p /mnt/iso/centos/7.6 &&mount /dev/cdrom /mnt/iso/centos/7.6 #step2: import iso (cobblerd service must be normal running) #cobbler import --path=/mnt/iso/centos/7.6 --name=CentOS7.6-x86_64 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7.6ks.cfg #step3:sync data and start dhcpd #cobbler sync && systemctl restart dhcpd xinetd httpd cobblerd #step4:start VM or physical machine and start pxe install system #cobbler help #list system iso command:cobbler list #change iso ks config:cobbler profile edit --name=CentOS7.6-x86_64 --kickstart=/var/lib/cobbler/sample_end.ks
以上就是基于centos7系列cobbler自動(dòng)安裝配置是怎樣的,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見到或用到的。希望你能通過這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。