(转)Cobbler无人值守批量安装Linux系统
本文目錄:
1.1 pxe安裝系統(tǒng)
1.2 cobbler基本介紹
1.3 安裝和配置cobbler
1.3.1 安裝cobbler
1.3.2 配置dhcp和tftp
1.4 cobbler從本地光盤安裝系統(tǒng)
1.4.1 生成distro
1.4.2 提供kickstart文件
1.4.3 提供profile
1.4.4 開始安裝
1.5 比pxe+kickstart好的地方
1.6 讓新機(jī)器自動(dòng)執(zhí)行腳本
?
1.1 pxe安裝系統(tǒng)
pxe的大致過(guò)程如下圖。
其中pxelinux.0為bootloader。pxelinux.cfg目錄下的文件(一般使用默認(rèn)的default文件)定義了安裝操作系統(tǒng)前的菜單項(xiàng),如kernel和Initrd的路徑,kickstart的路徑等。
首先客戶端請(qǐng)求pxe服務(wù)器上的dhcp,dhcp上指定了next-server和filename,它們分別是tftpd的地址和pxelinux.0的路徑;然后客戶端請(qǐng)求tftpd獲取pxelinux.0,執(zhí)行pxelinux.0后將引導(dǎo)進(jìn)入安裝界面,隨后獲取pxelinux.cfg目錄下的文件并讀取其中的配置,從中獲取kernel和initrd的路徑所在,如果有定義kickstart項(xiàng)則還會(huì)去獲取kickstart文件并讀取配置;再然后客戶端請(qǐng)求獲取kernel和initrd文件,以展開內(nèi)核并進(jìn)入到根文件系統(tǒng);最后客戶端獲取完成系統(tǒng)安裝所需的其他文件,這些文件可以是在pxe的本地,也可以是互聯(lián)網(wǎng)上等能獲取到的地方。
在閱讀本文之前,如果不懂pxe+kickstart,建議先學(xué)習(xí)下,對(duì)學(xué)習(xí)cobbler很有幫助。
PXE+Kickstart實(shí)現(xiàn)無(wú)人值守批量安裝Linux??http://www.linuxidc.com/Linux/2015-11/125040.htm
RHEL7/CentOS7 PXE+Kickstart自動(dòng)化系統(tǒng)安裝??http://www.linuxidc.com/Linux/2017-07/145399.htm
PXE+Kickstart安裝CentOS 7.3??http://www.linuxidc.com/Linux/2017-06/144789.htm
Linux運(yùn)維自動(dòng)化工具 Kickstart??http://www.linuxidc.com/Linux/2016-04/129978.htm
PXE+Kickstart無(wú)人值守安裝CentOS 7??http://www.linuxidc.com/Linux/2017-08/146169.htm
RHCE認(rèn)證之無(wú)人值守安裝Linux系統(tǒng)(FTP+TFTP+DHCP+Kickstart+PXE)?http://www.linuxidc.com/Linux/2013-10/91013.htm
CentOS Kickstart及引導(dǎo)鏡像文件制作??http://www.linuxidc.com/Linux/2017-05/143714.htm
Kickstart 全自動(dòng)安裝部署RHEL 7.0??http://www.linuxidc.com/Linux/2015-09/123312.htm
PXE+Kickstart無(wú)人值守安裝CentOS 6??http://www.linuxidc.com/Linux/2017-08/146170.htm
1.2 cobbler基本介紹
cobbler可以看作是一個(gè)更多功能的pxe,它實(shí)現(xiàn)系統(tǒng)安裝和pxe也差不多,需要的文件和過(guò)程大致都一樣。
cobbler能自動(dòng)管理dns/tftp/dhcp/rsync這四個(gè)服務(wù)(但似乎對(duì)tftp的管理有點(diǎn)bug,需要手動(dòng)啟動(dòng)tftp),且cobbler依賴于httpd(pxe支持http/nfs/ftp)。
基本的系統(tǒng)安裝,cobbler只需生成一個(gè)distro和一個(gè)profile即可。
distro相當(dāng)于一個(gè)鏡像,它提供安裝系統(tǒng)過(guò)程中所需的一切文件,如vmlinuz,initrd以及rpm包等。
profile的作用是為了自動(dòng)修改pxelinux.cfg/default文件,每生成或修改一次profile,都會(huì)在default文件中修改或追加對(duì)應(yīng)的label。
除了distro/profile之外,cobbler還管理system/images/repositories等,但是用的很少。
1.3 安裝和配置cobbler
1.3.1 安裝cobbler
cobbler在epel源中提供。由于還依賴于httpd、dhcp,所以httpd和dhcp也應(yīng)該裝上。
yum -y install cobbler cobbler-web pykickstart debmirror httpd dhcp其中cobbler-web是提供web管理界面的,pykicstart是檢查kicstart文件語(yǔ)法錯(cuò)誤的,debmirror是維護(hù)debian源的工具,此處用不上但有依賴關(guān)系,所以裝上。
安裝后,在/etc/cobbler生成以下文件。
[root@linuxidc ~]# cd /etc/cobbler/[root@linuxidc cobbler]# ls auth.conf distro_signatures.json modules.conf reporting tftpd.template zone_templates cheetah_macros dnsmasq.template mongodb.conf rsync.exclude users.conf cobbler_bash import_rsync_whitelist named.template rsync.template users.digest completions iso power secondary.template version dhcp.template ldap pxe settings zone.template先啟動(dòng)httpd,再啟動(dòng)cobblerd。
[root@linuxidc cobbler]# systemctl start httpd.service [root@linuxidc cobbler]# systemctl start cobblerd.service [root@linuxidc cobbler]# netstat -tnlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1298/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1402/master tcp 0 0 127.0.0.1:25151 0.0.0.0:* LISTEN 14091/python2 tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2261/mysqld tcp 0 0 :::22 :::* LISTEN 1298/sshd tcp 0 0 ::1:25 :::* LISTEN 1402/master tcp 0 0 :::443 :::* LISTEN 14037/httpd tcp 0 0 :::80 :::* LISTEN 14037/httpd啟動(dòng)之后,首先執(zhí)行cobbler check檢查配置是否正確。根據(jù)提示修改相關(guān)的配置項(xiàng)。
[root@linuxidc cobbler]# cobbler check The following are potential configuration items that you may want to fix:1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it. 2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network. 3 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements. 4 : change 'disable' to 'no' in /etc/xinetd.d/rsync 5 : comment out 'dists' on /etc/debmirror.conf for proper debian support 6 : comment out 'arches' on /etc/debmirror.conf for proper debian support 7 : ksvalidator was not found, install pykickstart 8 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one 9 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use themRestart cobblerd and then run 'cobbler sync' to apply changes.第一和第二個(gè)問(wèn)題:
[root@linuxidc cobbler]# vim /etc/cobbler/settingsnext_server: 172.16.10.10 server: 172.16.10.10第三個(gè)問(wèn)題:獲取pxelinux.0和menu.c32文件(對(duì)于centos來(lái)說(shuō)只需這兩個(gè)文件),可以像pxe一樣從syslinux包中手動(dòng)復(fù)制到/var/lib/cobbler/loaders目錄下,也可以執(zhí)行cobbler get-loaders自動(dòng)下載,但要求聯(lián)網(wǎng)。
[root@linuxidc cobbler]# cobbler get-loaders第四個(gè)問(wèn)題:有可能該問(wèn)題不是如此的,而是說(shuō)要將rsyncd.service使用給start且enable,只需systemctl enable rsyncd,systemctl start rsyncd。
[root@linuxidc cobbler]# vim /etc/xinetd.d/rsync disable=no [root@linuxidc cobbler]# service xinetd start第5、6個(gè)問(wèn)題,注釋掉/etc/debmirror.conf中相關(guān)項(xiàng)即可。
第7個(gè)問(wèn)題:因?yàn)橹鞍惭b的時(shí)候?qū)懗闪藀ykicstart,所以出錯(cuò)了這里。
[root@linuxidc cobbler]# yum -y install pykickstart第8個(gè)問(wèn)題:
[root@linuxidc cobbler]# openssl passwd -1 -salt `openssl rand -hex 8` '123456' $1$77e1022c$D9rxuxUWdc0NN46gzj9XT. [root@linuxidc cobbler]# vim /etc/cobbler/settings default_password_crypted: "$1$77e1022c$D9rxuxUWdc0NN46gzj9XT."第九個(gè)問(wèn)題和電源管理有關(guān),不用管了。直接重啟cobbler,然后cobbler sync。
[root@linuxidc cobbler]# service cobblerd restart[root@linuxidc cobbler]# cobbler check The following are potential configuration items that you may want to fix: 1 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them [root@linuxidc cobbler]# cobbler sync?cobbler sync命令用于將tftpboot目錄和/var/www/cobbler保持最新,當(dāng)/var/lib/cobbler或者kickstart文件發(fā)生了變化,應(yīng)該執(zhí)行一次cobbler sync或者直接重啟cobbler服務(wù)。
1.3.2 配置dhcp和tftp
如果在/etc/cobbler/setting中設(shè)置了manage_dhcp:1,表示由cobbler管理dhcp(默認(rèn)為0即人為手動(dòng)管理),則cobbler管理的dhcp的配置模板/etc/cobbler/dhcp.template會(huì)覆蓋/etc/dhcp/dhcpd.conf中配置,所以應(yīng)該修改dhcp.template。
此處采用默認(rèn)的不由cobbler管理dhcp。
[root@linuxidc cobbler]# yum-y install dhcp [root@linuxidc cobbler]# vim /etc/dhcp/dhcpd.conf ddns-update-style none; default-lease-time 259200; max-lease-time 518400; subnet 172.16.10.0 netmask 255.255.255.0 {range 172.16.10.20 172.16.10.50;option subnet-mask 255.255.255.0;next-server 172.16.10.10; # tftp的地址filename "pxelinux.0"; # pxelinux.0的路徑,此為tftp根目錄(/var/lib/tftpboot)的相對(duì)路徑 } [root@linuxidc cobbler]# service dhcpd restart關(guān)于tftp,在/etc/cobbler/settings中默認(rèn)啟用了由cobbler管理tftp,所以此處無(wú)需配置它。只要知道它的根目錄為/var/lib/tftpboot即可。但是如果后面裝系統(tǒng)的時(shí)候如果找不到tftp(應(yīng)該是cobbler管理tftp的bug),則手動(dòng)啟動(dòng)tftp即可。
1.4 cobbler從本地光盤安裝系統(tǒng)
1.4.1 生成distro
生成distro的方法有多種,可以從本地鏡像導(dǎo)入生成,也可以根據(jù)網(wǎng)絡(luò)上的資源生成。顯然,從本地生成的效率是最好的。
從本地導(dǎo)入的過(guò)程實(shí)際上是將系統(tǒng)鏡像中的文件復(fù)制到/var/www/cobbler/目錄(默認(rèn))下。
mkdir /mnt mount /dev/cdrom /mnt cobbler import --name=CentOS7.2 --path=/mnt等待導(dǎo)入完成,則表示distro生成完成。
[root@linuxidc cobbler]# ls -l /var/www/cobbler/images/CentOS7.2-x86_64/ total 38056 -r--r--r-- 3 root root 34815427 Oct 24 2014 initrd.img -r-xr-xr-x 3 root root 4152336 Oct 24 2014 vmlinuz [root@linuxidc cobbler]# ls -l /var/www/cobbler/ks_mirror/CentOS7.2/ # 此目錄完全來(lái)源于鏡像 total 340 -r--r--r-- 1 root root 14 Oct 24 2014 CentOS_BuildTag dr-xr-xr-x 3 root root 4096 Oct 24 2014 EFI -r--r--r-- 1 root root 212 Nov 28 2013 EULA -r--r--r-- 1 root root 18009 Nov 28 2013 GPL dr-xr-xr-x 3 root root 4096 Oct 24 2014 images dr-xr-xr-x 2 root root 4096 Oct 24 2014 isolinux dr-xr-xr-x 2 root root 278528 Oct 24 2014 Packages -r--r--r-- 1 root root 1354 Oct 20 2014 RELEASE-NOTES-en-US.html dr-xr-xr-x 2 root root 4096 Oct 24 2014 repodata -r--r--r-- 1 root root 1706 Nov 28 2013 RPM-GPG-KEY-CentOS-6 -r--r--r-- 1 root root 1730 Nov 28 2013 RPM-GPG-KEY-CentOS-Debug-6 -r--r--r-- 1 root root 1730 Nov 28 2013 RPM-GPG-KEY-CentOS-Security-6 -r--r--r-- 1 root root 1734 Nov 28 2013 RPM-GPG-KEY-CentOS-Testing-6 -r--r--r-- 1 root root 3380 Oct 24 2014 TRANS.TBL確保url路徑http://172.16.10.10/cobbler/ks_mirror/CentOS7.2/是有效的。
?
1.4.2 提供kickstart文件
以下是CentOS7的Kickstart內(nèi)容。如果要改為適合CentOS6的內(nèi)容,只需將keyboard項(xiàng)設(shè)置為"keyboard us",并修改下分區(qū)方式(如有必要的話)以及%post腳本段的內(nèi)容即可。
[root@linuxidc ~]# vim /var/lib/cobbler/kickstarts/CentOS7.2.ks #version=DEVEL # System authorization information auth --enableshadow --passalgo=sha512 # Install OS instead of upgrade install # Use network installation url --url=$tree # Use text mode install text # Firewall configuration firewall --disabled firstboot --disable # ignoredisk --only-use=sda # 此項(xiàng)是CentOS7默認(rèn)的項(xiàng),但cobbler編譯ks文件時(shí)不支持此語(yǔ)法,所以必須將此項(xiàng)注釋掉 # Keyboard layouts # old format: keyboard us # new format: keyboard --vckeymap=us --xlayouts='us' # System language lang en_US.UTF-8# Network information network --onboot=yes --bootproto=dhcp --device=eth0 --noipv6 network --hostname=node1.linuxidc.com # Reboot after installation reboot # Root password rootpw --iscrypted $6$KIPkwGVYqtjHln80$quxmkE5MKKA2LyzLOAc/s3FWH/jX76sObq6hqwOsEBoeMc/wIrzGG4xm72lkXwLeOfRLS/sl5vdajY9j34D4J. # SELinux configuration selinux --disabled # Do not configure the X Window System skipx # System timezone timezone Asia/Shanghai # System bootloader configuration bootloader --append="quiet crashkernel=auto" --location=mbr --boot-drive=sda # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all --initlabel # Disk partitioning information part /boot --asprimary --fstype="xfs" --size=250 part swap --fstype="swap" --size=2000 part / --asprimary --fstype="xfs" --grow --size=5000# 如果是要LVM分區(qū),則考慮以下分區(qū) # part /boot --fstype ext4 --size=100 # part swap --fstype=swap --size=2048 # part pv26 --size=100 --grow # volgroup VG00 --pesize=32768 pv26 # logvol / --fstype ext4 --name=LVroot --vgname=VG00 --size=29984 # logvol /data --fstype ext4 --name=LVdata --vgname=VG00 --size=100 --grow%post rm -f /etc/yum.repos.d/* cat >>/etc/yum.repos.d/my.repo<<eof [base] name=sohu baseurl=http://mirrors.sohu.com/centos/7/os/x86_64/ gpgcheck=0 enable=1 [epel] name=epel baseurl=http://mirrors.aliyun.com/epel/7Server/x86_64/ enable=1 gpgcheck=0 eof sed -i "s/rhgb //" /boot/grub2/grub.cfg sed -i "/UUID/d" /etc/sysconfig/network-scripts/ifcfg-eth0 echo "DNS1=114.114.114.114" >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo "UseDNS no" >> /etc/ssh/sshd_config sed -i "s/GSSAPIAuthentication yes/GSSAPIAuthentication no/" /etc/ssh/ssh_config sed -i "s/^SELINUX=.*$/SELINUX=disabled/" /etc/sysconfig/selinux systemctl disable firewalld %end%packages @base @core @development @platform-devel kexec-tools lftp tree lrzsz%end%addon com_RedHat_kdump --enable --reserve-mb='auto'%end?上面的url也可以寫成url --url="http://172.16.10.10/cobbler/ks_mirror/CentOS7.2/"。
?
1.4.3 提供profile
在導(dǎo)入鏡像生成distro的過(guò)程中,會(huì)自動(dòng)生成一個(gè)profile。
[root@linuxidc cobbler]# cobbler profile listCentOS7.2-x86_64該profile默認(rèn)使用的kickstart是/var/lib/cobbler/kickstarts/sample_end.ks,所以需要修改此項(xiàng)。
[root@linuxidc cobbler]# cobbler profile report --name=CentOS7.2-x86_64 Name : CentOS7.2-x86_64 TFTP Boot Files : {} Comment : DHCP Tag : default Distribution : CentOS7.2-x86_64 Enable gPXE? : 0 Enable PXE Menu? : 1 Fetchable Files : {} Kernel Options : {} Kernel Options (Post Install) : {} Kickstart : /var/lib/cobbler/kickstarts/sample_end.ks Kickstart Metadata : {} Management Classes : [] Management Parameters : <<inherit>> Name Servers : [] Name Servers Search Path : [] Owners : ['admin'] Parent Profile : Internal proxy : Red Hat Management Key : <<inherit>> Red Hat Management Server : <<inherit>> Repos : [] Server Override : <<inherit>> Template Files : {} Virt Auto Boot : 1 Virt Bridge : xenbr0 Virt CPUs : 1 Virt Disk Driver Type : raw Virt File Size(GB) : 5 Virt Path : Virt RAM (MB) : 512 Virt Type : kvm [root@linuxidc cobbler]# cobbler profile edit --name=CentOS7.2-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS7.2.ks[root@linuxidc cobbler]# cobbler profile report --name=CentOS7.2-x86_64 | grep -i kickstart Kickstart : /var/lib/cobbler/kickstarts/CentOS7.2.ks Kickstart Metadata : {}
對(duì)于centos7系列,則加上內(nèi)核啟動(dòng)參數(shù)net.ifnames和biosdevname使得網(wǎng)卡名使用ethN系列而不使用enoXXXXXXX這樣的隨機(jī)名稱。
[root@linuxidc cobbler]# cobbler profile edit --name=CentOS7.2-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS7.2.ks --kopts="net.ifnames=0 biosdevname=0" [root@linuxidc cobbler]# cobbler profile report --name=CentOS7.2-x86_64 | grep -Ei 'kernel|kickstart'Kernel Options : {'biosdevname': '0', 'net.ifnames': '0'} Kernel Options (Post Install) : {} Kickstart : /var/lib/cobbler/kickstarts/CentOS7.2.ks Kickstart Metadata : {}
當(dāng)然,不使用自生成的profile,自己添加一個(gè)profile也可以,同時(shí)還可以設(shè)置profile選項(xiàng),如"--kickstart"項(xiàng)。如下:其中"--distro"指定該profile是添加到哪個(gè)distro下的。
[root@linuxidc cobbler]# cobbler profile add --name=CentOS7.2.1-x86_64 --distro=CentOS7.2-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS7.2.ks實(shí)際上,每添加一個(gè)profile都是在向/var/lib/tftpboot/pxelinux.cfg/default中添加一個(gè)label。
[root@linuxidc cobbler]# cat /var/lib/tftpboot/pxelinux.cfg/default DEFAULT menu PROMPT 0 MENU TITLE Cobbler | http://cobbler.github.io/ TIMEOUT 200 TOTALTIMEOUT 6000 ONTIMEOUT localLABEL localMENU LABEL (local)MENU DEFAULTLOCALBOOT -1LABEL CentOS7.2-x86_64kernel /images/CentOS7.2-x86_64/vmlinuzMENU LABEL CentOS7.2-x86_64append initrd=/images/CentOS7.2-x86_64/initrd.img ksdevice=bootif lang= text net.ifnames=0 biosdevname=0 kssendmac ks=http://172.16.10.10/cblr/svc/op/ks/profile/CentOS7.2-x86_64ipappend 2LABEL CentOS7.2.1-x86_64kernel /images/CentOS7.2-x86_64/vmlinuzMENU LABEL CentOS7.2.1-x86_64append initrd=/images/CentOS7.2-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://172.16.10.10/cblr/svc/op/ks/profile/CentOS7.2.1-x86_64ipappend 2MENU end也就是說(shuō),其實(shí)可以不用生成profile,自己手動(dòng)編輯label也可以。
默認(rèn)使用的菜單背景圖片是menu.c32,此處我改為vesamenu.c32,該背景圖片是從syslinux包中提取的,背景圖片而已,看個(gè)人喜好了。另外默認(rèn)菜單等待時(shí)間是2秒,在自動(dòng)安裝的環(huán)境中,可以將其設(shè)置的短些。并且進(jìn)入菜單默認(rèn)停留在local,即從本地啟動(dòng)系統(tǒng),但是此時(shí)系統(tǒng)還沒裝,所以要實(shí)現(xiàn)自動(dòng)化,建議修改此項(xiàng)。
以下是修改后的項(xiàng)。
DEFAULT vemamenu DEFAULT menu PROMPT 0 MENU TITLE Cobbler | http://cobbler.github.io/ TIMEOUT 20 TOTALTIMEOUT 6000 ONTIMEOUT CentOS7.2-x86_64LABEL localMENU LABEL (local)LOCALBOOT -1LABEL CentOS7.2-x86_64kernel /images/CentOS7.2-x86_64/vmlinuz MENU DEFAULTMENU LABEL CentOS7.2-x86_64 append initrd=/images/CentOS7.2-x86_64/initrd.img ksdevice=bootif lang= text net.ifnames=0 biosdevname=0 kssendmac ks=http://172.16.10.10/cblr/svc/op/ks/profile/CentOS7.2-x86_64ipappend 2LABEL CentOS7.2.1-x86_64kernel /images/CentOS7.2-x86_64/vmlinuzMENU LABEL CentOS7.2.1-x86_64append initrd=/images/CentOS7.2-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://172.16.10.10/cblr/svc/op/ks/profile/CentOS7.2.1-x86_64ipappend 2MENU end在開始安裝之前,要確保該ks路徑是有效的且kickstart內(nèi)容是正確的。有時(shí)候提供的Kickstart內(nèi)容錯(cuò)誤了,在制作成profile的時(shí)候不會(huì)報(bào)錯(cuò),但實(shí)際上瀏覽器訪問(wèn)該ks路徑的內(nèi)容提示錯(cuò)誤。例如,訪問(wèn)CentOS7.2.1-x86_64這個(gè)LABEL的kickstart文件,將其ks文件url地址http://172.16.10.10/cblr/svc/op/ks/profile/CentOS7.2.1-x86_64輸入瀏覽器中。如果得到如下結(jié)果,則表示出錯(cuò)了,很大的可能是cobbler不支持kickstart中的某指令,這個(gè)需要慢慢檢查。
# This kickstart had errors that prevented it from being rendered correctly. # The cobbler.log should have information relating to this failure.修改kickstart文件后,需要重新編譯profile加載新的kickstart文件。只需使用cobbler profile edit --name=XXXXX --kickstart=YYYYY即可重新編譯XXXXX這個(gè)profile,或者執(zhí)行cobbler sync命令。直到瀏覽器中能獲取到kickstart的內(nèi)容時(shí)才算成功。
或者,使用cobbler profile getks --name=XXXXX命令獲取名為XXXXX的profile的ks內(nèi)容。
總之,必須要保證能正確獲取到ks內(nèi)容。
1.4.4 開始安裝
準(zhǔn)備一個(gè)新的機(jī)器開機(jī)就會(huì)自動(dòng)進(jìn)入菜單,2-3秒超時(shí)后自動(dòng)進(jìn)行安裝,安裝完成后自動(dòng)重啟,重啟時(shí)自動(dòng)從本地啟動(dòng)。
所以,除了對(duì)新機(jī)器進(jìn)行開機(jī),其他的一切完完全全是全自動(dòng)的。
建議在真正開始安裝前,將dhcpd/rsyncd/tftp/cobbler等給重啟一遍,防止中間改過(guò)哪些地方忘記重啟而導(dǎo)致裝機(jī)時(shí)出錯(cuò)。
1.5 比pxe+kickstart好的地方
僅就cobbler基本功能而言,它跟pxe的能力基本是一樣的,只是提供了更多花哨的功能。
但cobbler能夠使用變量,能夠通過(guò)幾個(gè)命令自動(dòng)完成文件復(fù)制,修改等繁瑣的動(dòng)作,另外它提供了api接口,常用的是它的圖形界面。在這一點(diǎn)上,它還是不錯(cuò)的。
1.6 讓新機(jī)器自動(dòng)執(zhí)行腳本
有些時(shí)候新機(jī)器上要進(jìn)行很多配置,在kickstart的%post段也可以配置,但是這里能進(jìn)行的配置是有限的。
可以在cobbler服務(wù)端寫好要執(zhí)行的腳本,然后在新機(jī)器上將腳本使用scp復(fù)制過(guò)去,但是scp復(fù)制需要確認(rèn)和輸入密碼,所以需要在kickstart的選包部分指定安裝expect包,然后使用expect進(jìn)行非交互scp。
最后在%post段直接執(zhí)行此腳本即可。
本文永久更新鏈接地址:http://www.linuxidc.com/Linux/2017-08/146171.htm
轉(zhuǎn)載于:https://www.cnblogs.com/liujiacai/p/8685690.html
總結(jié)
以上是生活随笔為你收集整理的(转)Cobbler无人值守批量安装Linux系统的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: JavaScript:Browser 对
- 下一篇: Linux在线扫描热添加的SCSI/iS