In the production environment will inevitably encounter, some servers need to install CentOS, some servers need to install Ubuntu, or some systems need to install centos6.4 some systems need to install centos6.5, then PXE can not meet our requirements. This article describes cobbler to implement this functionality.
Cobbler Required Services:
u TFTP
u Rsync
u DHCP
u DNS(On demand)
Cobbler Command:
u Import
u Sync
u Reposync
u Build ISO
Core concept:
Distros: Define boot kernel,initrd file, etc.
Profiles: Specify Kickstart to specify level
Cobbler:
First,Installing Cobbler
Prerequisite:Cobbler is provided by the Epel Source, so it is necessary to configure the Yum that points to Epel beforehand The source can perform the installation process similar to the following.
Note Turn off selinux
wget http://mirrors.opencas.cn/epel/6/i386/epel-release-6-8.noarch.rpm
RPM-IVH epel-release-6-8.noarch.rpm
Yum Clean All
# yum Install cobbler Cobbler-web pykickstart debmirror-y
# service Htt PD Start
# service Cobblerd Start
# Cobbler Check
Perform thecobbler Check command to examine the problems that are stored, and then follow the prompts to resolve them individually. The common problems are as follows:
1:the ' server ' field in/etc/cobbler/settings must is set to something other than localhost, or kickstarting features WI ll not work. This should is a resolvable hostname or IP for the boot server as reachable by all machines that would 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 ' dists ' on/etc/debmirror.conf for proper Debian support
6:comment ' arches ' on/etc/debmirror.conf for proper Debian support
7:the default password used by the sample templates for newly installed machines (default_password_crypted IN/ETC/COBBL Er/settings) is still set to ' cobbler ' and should be changed, try: "OpenSSL passwd-1-salt ' Random-phrase-here ' Your-pas Sword-here ' "To generate new one
8:fencing tools were not found, and is required to use the (optional) power management features. Install Cman or fence-agents to use them
Restart Cobblerd and then run ' Cobbler Sync ' to apply changes.
The workarounds for the above problems are as follows:
1. Modify The value of the server parameter in the /etc/cobbler/settings file to provide cobbler The corresponding IP address or hostname of the service host, such as 172.16.100.15;
2 next_server pxe The host of the service corresponding ip address, such as 172.16.100.16
3, if the current node can access the Internet, execute "cobbler get-loaders" command, otherwise, you need to install the syslinux Package, and then copy /usr/share/syslinux/{pxelinux.0,memu.c32} and other files to the /var/lib/cobbler/loaders/ directory;
4, the implementation of "chkconfig rsyncon" command can be;
5.Note "@dists =" Sid " in the /etc/debmirror.conf file; "one line;
6.Note "@arches =" i386 " in the /etc/debmirror.conf file; "one line;
7.Execute "OpenSSL passwd-1-salt $ (OpenSSL rand-hex 4)" to generate the password and replace it with /etc/cobbler/settings The value of the default_password_crypted parameter in the file ;
8, the implementation of "yum install cman fence-agents" command to install the corresponding package can be;
Then restart cobblerd, then perform "cobbler sync" To synchronize the new configuration to cobbler.
Second, Install DHCP
Yum Install Dhcp-y
Vim/etc/dhcp/dhcpd.conf
Option Domain-name "magedu.com";
Option Domain-name-servers 192.168.10.254,172.16.0.1;
Default-lease-time 43200;
Max-lease-time 86400;
Log-facility Local7;
Subnet 192.168.10.0 netmask 255.255.255.0 {
Range 192.168.10.21 192.168.10.100;
Option routers 192.168.10.254;
}
Next-server 192.168.10.254;
Filename= "pxelinux.0";
Service DHCPD Start
Service xinetd Restart
Cobbler Sync
Import image file:
Insert Disc
Mount [[email protected] ~]# MOUNT/DEV/CDROM/MISC/CD
Cobbler Import--name= "rhel-6.5-x86_64"--PATH=/MISC/CD
Cobbler distro list View
Configuration Kickstart
Yum Install System-config-kickstart-y
System-config-kickstart
Kickstart configuration Reference Online Other examples, here do not introduce
Vim Defcault.cfg
URL--url= "Http://192.168.100.1/cobbler/ks_mirror/rhel-5.4-x86"
add profile
Cp/root/rhel-x86.cfg/var/lib/cobbler/kickstarts
Cobbler profile Add--name=rhel-5.4-i386-basic--distro=rhel-5.4-i386--kickstart=/var/lib/cobbler/kickstarts/ Rhel-x86.cfg
Copy ks.cfg file
Cp/var/lib/cobbler/kickstarts/ks.cfg/var/www/html/cobbler/ks.cfg
Edit and Modify
Vim/var/lib/tftpboot/pxelinux.cfg/default
Ks=http://192.168.19.42/cobbler/ks.cfg
Restart Service
Service Cobblerd Restart
Cobbler List View
Turn on the virtual machine test !!!
Cobbler automated deployment of multiple types of operating systems, one software all done