首页 > 代码库 > 【环境搭建】 automatic installation task(1) -- cobbler
【环境搭建】 automatic installation task(1) -- cobbler
1. Summary:
To make my work easier!
Here is the website http://cobbler.github.io/
2. Environment
2.1 OS: CentOS Linux release 7.2.1511 (Core)
2.2 Softwares and Packages:
cobbler 2.6.11-1.el7
dhcp 12:4.2.5-42.el7.centos
3. Installation
yum install cobbler -y
=============================================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================================== Installing: cobbler x86_64 2.6.11-1.el7 epel 585 k Installing for dependencies: PyYAML x86_64 3.10-11.el7 base 153 k apr x86_64 1.4.8-3.el7 base 103 k apr-util x86_64 1.5.2-6.el7 base 92 k httpd x86_64 2.4.6-40.el7.centos.4 updates 2.7 M httpd-tools x86_64 2.4.6-40.el7.centos.4 updates 83 k libyaml x86_64 0.1.4-11.el7_0 base 55 k mailcap noarch 2.1.41-2.el7 base 31 k mod_wsgi x86_64 3.4-12.el7_0 base 76 k python-cheetah x86_64 2.4.4-5.el7.centos extras 341 k python-markdown noarch 2.4.1-1.el7.centos extras 186 k python-pillow x86_64 2.0.0-19.gitd1c6db8.el7 base 438 k python-pygments noarch 1.4-9.el7 base 599 k python-simplejson x86_64 3.3.3-1.el7 epel 171 k syslinux x86_64 4.05-12.el7 base 990 k tftp-server x86_64 5.2-12.el7 base 44 k Transaction Summary =============================================================================================================================================================================================== Install 1 Package (+15 Dependent packages)
yum install dhcp -y
=============================================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================================== Installing: dhcp x86_64 12:4.2.5-42.el7.centos base 511 k Transaction Summary =============================================================================================================================================================================================== Install 1 Package
yum install xinetd -y
=============================================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================================== Installing: xinetd x86_64 2:2.3.15-12.el7 base 128 k Transaction Summary =============================================================================================================================================================================================== Install 1 Package
yum install cobbler-web -y #Web management based on django, can be ignore if you don‘t want, defualt using httpd
=============================================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================================== Installing: cobbler-web noarch 2.6.11-1.el7 epel 285 k Installing for dependencies: mod_ssl x86_64 1:2.4.6-40.el7.centos.4 updates 104 k python-django noarch 1.6.11-5.el7 epel 4.0 M python-django-bash-completion noarch 1.6.11-5.el7 epel 16 k Transaction Summary =============================================================================================================================================================================================== Install 1 Package (+3 Dependent packages)
4. Configuration
4.1 Path
etc: /etc/cobbler/*
bin: /usr/bin/cobbler* /usr/sbin/tftpd.py
lib /usr/lib/python2.7/site-packages/*
systemctl: /usr/lib/systemd/system/cobblerd.service
doc: /usr/share/doc/cobbler-2.6.11 /usr/share/man/man1/cobbler.1.gz
deport: /var/lib/tftpboot/
log: /var/log/cobbler
web: /var/www/cobbler
4.2 Process
cobbler: systemctl enable/start/stop/restart cobblerd.service
httpd: systemctl enable/start/stop/restart httpd.service
dhcp: systemctl enable dhcpd.service
rsyncd: systemctl enable rsyncd.service
4.3 Configuration
4.3.1 check
[root@node01 yum.repos.d]# 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. # this is the address of the cobbler server -- as it is used # by systems during the install process, it must be the address # or hostname of the system as those systems can see the server. # if you have a server that appears differently to different subnets # (dual homed, etc), you need to read the --server-override section # of the manpage for how that works. >>server: 127.0.0.1 ==> server: 192.168.1.99 # Change the server to your IP 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. # if using cobbler with manage_dhcp, put the IP address # of the cobbler server here so that PXE booting guests can find it # if you do not set this correctly, this will be manifested in TFTP open timeouts. >>next_server: 127.0.0.1 ==> server: 192.168.1.99 3 : change ‘disable‘ to ‘no‘ in /etc/xinetd.d/tftp >>disable = 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 ensu re 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. >> run command "cobbler get-loaders" 5 : enable and start rsyncd.service with systemctl >> rum command "systemctl enable rsyncd.service" 6 : debmirror package is not installed, it will be required to manage debian deployments and repositories >> Can be ignored. No package for CentOS 7. If you are using CentOS 6, try http://rpmfind.net/linux/rpm2html/search.php?query=debmirror 7 : 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: "o penssl passwd -1 -salt ‘random-phrase-here‘ ‘your-password-here‘" to generate new one8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them >> openssl passwd -1 -salt ‘cobbler‘ ‘Passw0rd‘ Restart cobblerd and then run ‘cobbler sync‘ to apply changes.
4.3.2 configuration
create cobbler management account: htdigest /etc/cobbler/users.digest "cobbler" cobbler
change "/etc/cobbler/settings"
# set to 1 to enable Cobbler‘s DHCP management features. # the choice of DHCP management engine is in /etc/cobbler/modules.conf manage_dhcp: 0 ==> manage_dhcp: 1 # if this setting is set to 1, cobbler systems that pxe boot # will request at the end of their installation to toggle the # --netboot-enabled record in the cobbler system record. This eliminates # the potential for a PXE boot loop if the system is set to PXE # first in it‘s BIOS order. Enable this if PXE is first in your BIOS # boot order, otherwise leave this disabled. See the manpage # for --netboot-enabled. pxe_just_once: 0 ==> pxe_just_once: 1 # set to 1 to enable Cobbler‘s RSYNC management features. manage_rsync: 0 ==> manage_rsync: 1
change "/etc/cobbler/dhcp.template"
subnet 192.168.1.0 netmask 255.255.255.0 { option routers 192.168.1.5; option domain-name-servers 192.168.1.1; option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.1.100 192.168.1.254; ==> range dynamic-bootp 192.168.1.200 192.168.1.254; default-lease-time 21600; max-lease-time 43200; next-server $next_server;
mount iso
#mount -t auto -o loop /deport/BaiduYunDownload/rhel-server-7.2-x86_64-dvd.iso /deport/mnt/RHEL72/ #cobbler import --path=/deport/mnt/RHEL72 --name=rhel7.2 task started: 2016-11-14_132914_import task started (id=Media import, time=Mon Nov 14 13:29:14 2016) Found a candidate signature: breed=redhat, version=rhel6 Found a candidate signature: breed=redhat, version=rhel7 Found a matching signature: breed=redhat, version=rhel7 Adding distros from path /var/www/cobbler/ks_mirror/rhel7.2: creating new distro: rhel7.2-x86_64 trying symlink: /var/www/cobbler/ks_mirror/rhel7.2 -> /var/www/cobbler/links/rhel7.2-x86_64 creating new profile: rhel7.2-x86_64 associating repos checking for rsync repo(s) checking for rhn repo(s) checking for yum repo(s) starting descent into /var/www/cobbler/ks_mirror/rhel7.2 for rhel7.2-x86_64 processing repo at : /var/www/cobbler/ks_mirror/rhel7.2 need to process repo/comps: /var/www/cobbler/ks_mirror/rhel7.2 looking for /var/www/cobbler/ks_mirror/rhel7.2/repodata/*comps*.xml Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel7.2/repodata processing repo at : /var/www/cobbler/ks_mirror/rhel7.2/addons/HighAvailability need to process repo/comps: /var/www/cobbler/ks_mirror/rhel7.2/addons/HighAvailability looking for /var/www/cobbler/ks_mirror/rhel7.2/addons/HighAvailability/repodata/*comps*.xml Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel7.2/addons/HighAvailability/repodata processing repo at : /var/www/cobbler/ks_mirror/rhel7.2/addons/ResilientStorage need to process repo/comps: /var/www/cobbler/ks_mirror/rhel7.2/addons/ResilientStorage looking for /var/www/cobbler/ks_mirror/rhel7.2/addons/ResilientStorage/repodata/*comps*.xml Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel7.2/addons/ResilientStorage/repodata *** TASK COMPLETE ***
restart services
#systemctl restart cobblerd.service #systemctl restart xinetd.service #systemctl restart dhcpd.service #cobbler sync
4.4 Commands
[root@node01 mnt]# cobbler distro list rhel7.2-x86_64 [root@node01 mnt]# cobbler profile list rhel7.2-x86_64 [root@node01 mnt]#
4.5 Web management
https://192.168.1.99/cobbler_web
【环境搭建】 automatic installation task(1) -- cobbler