@cdmonkey
2018-10-23T12:27:33.000000Z
字数 8647
阅读 1188
运维工具
[root@Node-A1 ~]# yum install -y httpd dhcp tftp cobbler cobbler-web
启动服务:
[root@Node-A1 ~]# /etc/init.d/httpd start[root@Node-A1 ~]# /etc/init.d/cobblerd start
[root@Node-A1 ~]# cobbler checkThe following are potential configuration items that you may want to fix:1 :2 :...#这里显示的提示信息是当前发现的问题,当这些问题解决了才能正确的工作。Restart cobblerd and then run 'cobbler sync' to apply changes.
根据提示解决问题:
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.
[root@Node-A1 ~]# vim /etc/cobbler/settings#272:next_server: 127.0.0.1 --> next_server: 172.16.1.21#384:server: 127.0.0.1 --> server: 172.16.1.21
以上两个地址(server & next_server)应修改为本服务器的地址。
3 : change 'disable' to 'no' in /etc/xinetd.d/tftp
[root@Node-A1 ~]# vim /etc/xinetd.d/tftpdisable = yes --> disable = no
4 : 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.
[root@Node-A1 ~]# cobbler get-loaderstask started: 2015-09-15_110812_get_loaders...*** TASK COMPLETE ***
5 : change 'disable' to 'no' in /etc/xinetd.d/rsync
[root@Node-A1 ~]# vim /etc/xinetd.d/rsyncdisable = yes --> disable = no#Restart xinetd service:[root@Node-A1 ~]# /etc/init.d/xinetd restart
6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
该条提示信息可以忽略。
7 : ksvalidator was not found, install pykickstart
[root@Node-A1 ~]# yum install -y 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
#首先需要生成加密后的密码:[root@Node-A1 ~]# openssl passwd -1 -salt 'cdmonkey' '123456'$1$cdmonkey$G/SY3idUd.svpaoBDS5Gq/[root@Node-A1 ~]# vim /etc/cobbler/settings#101:default_password_crypted: "$1$mF86/UHC$WvcIcX2t6crBz2onWxyac." -->default_password_crypted: "$1$cdmonkey$G/SY3idUd.svpaoBDS5Gq/"
该命令的用法:任意字符(random-phrase)可以随便写,这个密码就是安装完系统根用户的密码了。
9 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
该条提示信息可以忽略。
处理完上述提示信息后重启“Cobbler”服务,并重新执行检查操作:
#Restart cobbler service:[root@Node-A1 ~]# /etc/init.d/cobblerd restart#Recheck:[root@Node-A1 ~]# cobbler checkThe following are potential configuration items that you may want to fix:1 : debmirror package is not installed, it will be required to manage debian deployments and repositories2 : 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.
按照上面的提示,执行同步指令已同意上述变更:
[root@Node-A1 ~]# cobbler synctask started: 2015-09-15_113820_sync...*** TASK COMPLETE ***
至此为止,服务安装成功。
首先,我们如果要通过“Cobbler”来管理DHCP的话,那么需要修改对应的设置文件模板,而不再使用DHCP自身的设置文件,服务会自动生成DHCP的设置文件。
[root@Node-A1 ~]# vim /etc/cobbler/dhcp.template#在此需要按照你试驾的网络情况进行设置(除此之外的内容使用默认即可):subnet 172.16.1.0 netmask 255.255.255.0 {option routers 172.16.1.2;option domain-name-servers 172.16.1.2;option subnet-mask 255.255.255.0;range dynamic-bootp 172.16.1.100 172.16.1.254;default-lease-time 21600;max-lease-time 43200;next-server $next_server;
[root@Node-A1 ~]# vim /etc/cobbler/settings#242:manage_dhcp: 0 --> manage_dhcp: 1 #Allow Cobbler to manage the DHCP.#Restart cobbler service:[root@Node-A1 ~]# /etc/init.d/cobblerd restart#Sync:[root@Node-A1 ~]# cobbler sync
挂载光盘镜像文件:
mount -o loop -t iso9660 /root/ISO/CentOS-6.6-x86_64-bin-DVD1.iso /mnt/cdrom/
[root@Node-A1 ~]# cobbler import --path=/mnt/cdrom/ --name=CentOS-6.6-x86_64 --arch=x86_64task started: 2015-09-15_150614_import...*** TASK COMPLETE ***
查看当前的已有的设置文件:
[root@Node-A1 ~]# cobbler profile reportName : CentOS-6.6-x86_64TFTP Boot Files : {}Comment :DHCP Tag : defaultDistribution : CentOS-6.6-x86_64Enable gPXE? : 0Enable PXE Menu? : 1Fetchable Files : {}Kernel Options : {}Kernel Options (Post Install) : {}Kickstart : /var/lib/cobbler/kickstarts/sample_end.ksKickstart 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 : 1Virt Bridge : xenbr0Virt CPUs : 1Virt Disk Driver Type : rawVirt File Size(GB) : 5Virt Path :Virt RAM (MB) : 512Virt Type : kvm
通过上面的输出可以看出,存在一个默认的Kickstart文件,我们不使用该默认的文件,而是另外指定一个Kickstart文件来使用。首先创建该文件:
[root@Node-A1 ~]# cat /var/lib/cobbler/kickstarts/CentOS-6.5-x86_64.cfg#Kickstart Configurator by Jason Zhao#platform=x86, AMD64, or Intel EM64Tkey --skip#System languagelang en_US#System keyboardkeyboard us#Sytem timezonetimezone Asia/Shanghai#Root passwordrootpw --iscrypted $default_password_crypted#Use text mode installtext#Install OS instead of upgradeinstall#Use NFS installation Mediaurl --url=$tree#System bootloader configurationbootloader --location=mbr#Clear the Master Boot Recordzerombr yes#Partition clearing informationclearpart --all --initlabel#Disk partitioning informationpart /boot --fstype ext4 --size 1024 --ondisk sdapart swap --size 16384 --ondisk sdapart / --fstype ext4 --size 1 --grow --ondisk sda#System authorization infomationauth --useshadow --enablemd5#Network information#$SNIPPET('network_config')network --bootproto=dhcp --device=eth0 --onboot=on# Reboot after installationreboot#Firewall configurationfirewall --disabled#SELinux configurationselinux --disabled#Do not configure XWindowsskipx#Package install information%packages@ base@ chinese-support@ coresysstatiptrafntpe2fsprogs-develkeyutils-libs-develkrb5-devellibselinux-devellibsepol-devellrzszncurses-developenssl-develzlib-develOpenIPMI-toolsmysqllockdevminicomnmap%post#/bin/sed -i 's/#Protocol 2,1/Protocol 2/' /etc/ssh/sshd_config/bin/sed -i 's/^ca::ctrlaltdel:/#ca::ctrlaltdel:/' /etc/inittab/sbin/chkconfig --level 3 diskdump off/sbin/chkconfig --level 3 dc_server off/sbin/chkconfig --level 3 nscd off/sbin/chkconfig --level 3 netfs off/sbin/chkconfig --level 3 psacct off/sbin/chkconfig --level 3 mdmpd off/sbin/chkconfig --level 3 netdump off/sbin/chkconfig --level 3 readahead off/sbin/chkconfig --level 3 wpa_supplicant off/sbin/chkconfig --level 3 mdmonitor off/sbin/chkconfig --level 3 microcode_ctl off/sbin/chkconfig --level 3 xfs off/sbin/chkconfig --level 3 lvm2-monitor off/sbin/chkconfig --level 3 iptables off/sbin/chkconfig --level 3 nfs off/sbin/chkconfig --level 3 ipmi off/sbin/chkconfig --level 3 autofs off/sbin/chkconfig --level 3 iiim off/sbin/chkconfig --level 3 cups off/sbin/chkconfig --level 3 openibd off/sbin/chkconfig --level 3 saslauthd off/sbin/chkconfig --level 3 ypbind off/sbin/chkconfig --level 3 auditd off/sbin/chkconfig --level 3 rdisc off/sbin/chkconfig --level 3 tog-pegasus off/sbin/chkconfig --level 3 rpcgssd off/sbin/chkconfig --level 3 kudzu off/sbin/chkconfig --level 3 gpm off/sbin/chkconfig --level 3 arptables_jf off/sbin/chkconfig --level 3 dc_client off/sbin/chkconfig --level 3 lm_sensors off/sbin/chkconfig --level 3 apmd off/sbin/chkconfig --level 3 sysstat off/sbin/chkconfig --level 3 cpuspeed off/sbin/chkconfig --level 3 rpcidmapd off/sbin/chkconfig --level 3 rawdevices off/sbin/chkconfig --level 3 rhnsd off/sbin/chkconfig --level 3 nfslock off/sbin/chkconfig --level 3 winbind off/sbin/chkconfig --level 3 bluetooth off/sbin/chkconfig --level 3 isdn off/sbin/chkconfig --level 3 portmap off/sbin/chkconfig --level 3 anacron off/sbin/chkconfig --level 3 irda off/sbin/chkconfig --level 3 NetworkManager off/sbin/chkconfig --level 3 acpid off/sbin/chkconfig --level 3 pcmcia off/sbin/chkconfig --level 3 atd off/sbin/chkconfig --level 3 sendmail off/sbin/chkconfig --level 3 haldaemon off/sbin/chkconfig --level 3 smartd off/sbin/chkconfig --level 3 xinetd off/sbin/chkconfig --level 3 netplugd off/sbin/chkconfig --level 3 readahead_early off/sbin/chkconfig --level 3 xinetd off/sbin/chkconfig --level 3 ntpd on/sbin/chkconfig --level 3 avahi-daemon off/sbin/chkconfig --level 3 ip6tables off/sbin/chkconfig --level 3 restorecond off/sbin/chkconfig --level 3 postfix off
指定kickstart文件:
[root@Node-A1 ~]# cobbler profile edit --name=CentOS-6.6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-6.6-x86_64.cfg---------------#Sync:[root@Node-A1 ~]# cobbler sync
注意:进行了任何的改动后都要执行同步指令。
列出当前已有的镜像文件:
[root@Node-A1 ~]# cobbler distro listCentOS-6.6-x86_64
[root@Node-A1 ~]# vim /etc/cobbler/modules.conf
[root@Node-A1 ~]# htdigest /etc/cobbler/users.digest "Cobbler" cobblerChanging password for user cobbler in realm CobblerNew password:Re-type new password:---------------------#Restart service:[root@Node-A1 ~]# /etc/init.d/httpd restart[root@Node-A1 ~]# /etc/init.d/cobblerd restart