Article Structure
1. Preface 2. Cobbler installation 3. System customization 4. Reference
Preface:
If you have installed a system on your computer, you know that you must first set the boot item (or use the boot shortcut key) in the BIOS for system installation from a USB flash drive, optical drive, or other devices ). I have installed the system for hundreds of times since I went to college, but I have never started and installed it from the NIC. Although I have noticed it before, I have never known what it is, see figure (1 ). Some time ago, I had the honor to have access to the automatic installation and deployment of openstack at the internship Company. It turned out to be a remote startup technology from the Nic!
Figure 1 BIOS startup Item Page
To start from the network card, your network card must support PXE (preboot execution environment, pre-boot environment), and the PXE client must exist in the ROM of the network card. PXE is developed by Intel and provides a mechanism to enable the computer from the NIC, working in Client/Server mode. Generally, a host acts as the server of PXE and enables services such as DHCP and TFTP on which PXE remotely starts. When a client starts through the NIC, a DHCP request is sent to the server to obtain information about the IP address, gateway, and TFTP server from the PXE Server. Then, the information is transmitted through the TFTP protocol (the TFTP client is included in the nic rom) automatically download the boot loader used to boot the operating system to the local memory (different operating system architectures use different PXE boot files, which will be further mentioned later ), then, load the Startup file of the operating system through the software to start installing the operating system.
In practice, centos6.5 is used as an example. The PXE boot file mentioned above is/var/tftboot/pxelinux.0, and some customized installation is required, create a new/var/tftboot/pxtlinux folder and customize the folder *. cfg file to customize the operating system (such as language, time zone, password, partition, network configuration, installation package selection, and subsequent operations after the system is installed ), create a file named default in this directory and specify the System custom file *. cfg. Such a series of operations and system customization are obviously cumbersome and will only increase the workload of O & M personnel! RedHat introduces KickStart and cobbler, which are used to customize and automatically deploy and install the operating system. Among them, cobbler integrates KickStart and is more powerful!
Next we will learn how to install cobbler step by step!
Cobbler installation:
0. Environment:VMware Virtual Environment centos6.5-x86_64 (basic-server)
IP: 192.168.10.160 hostname: cobbler.test.com
Note: You must disable the DHCP service provided by VMware;
1. system updates
yum -y update
2. install the software package:
yum –y install httpd tftp-server xinetd dhcp cobbler bind puppet puppet–server facter
Note: (a) HTTP is used to download files required for operating system installation from the server of PXE client; (B) cobbler can complete puppet installation and signature authentication for puppet client; (c) you can also install cobbler-web, which provides a Web interface for easier operations.
3. modify the configuration file and start the service:
(1) Disable SELinux
Sed-I's/SELinux =. */SELinux = disabled/G'/etc/SELinux/config # restart to take effect. setenforce 0 takes effect temporarily.
(2) Set cobbler Server IP: Vim/etc/cobblet/settings
1 server: set your cobbler ip here, e.g. 192.168.10.1602 next_server: set your cobbler ip here, e.g. 192.168.10.160
(3) set DHCP:
A. Vim/etc/cobbler/settings
manage_dhcp: 1
B. Vim/etc/cobbler/DHCP. template. This file is a template for cobbler to manage DHCP.
1 ddns-Update-style interim; 2 3 allow booting; 4 allow BOOTP; 5 6 ignore client-updates; 7 set vendorclass = option vendor-class-identifier; 8 9 option PXE-system-type code 93 = unsigned integer 16; 10 11 subnet 192.168.10.0 netmask 255.255.255.0 {# change to the CIDR Block of the host where cobbler is located 12 option routers 192.168.10.5; # Route 13 option domain-name-servers 192.168.10.160; # DNS server14 option subnet-mask 255.255.255.0; # netmast15 range dynamic-BOOTP 192.168.10.161 192.168.10.170; # The IP address allocated by the DHCP service is 16 default-lease-time 21600; 17 max-lease-time 43200; 18 next-server $ next_server; 19 class "pxeclients" {20 match if substring (option vendor-class-identifier, 0, 9) = "pxeclient "; 21 if option PXE-system-type = {22 FILENAME "Grub/grub-x86.efi"; 23} else if option PXE-system-type = {24 FILENAME "Grub/grub-x86_64.efi "; 25} else {26 FILENAME "pxelinux.0"; 27} 28} 29 30}
(4) set DNS:
A. Vim/etc/cobbler/settings
manage_dns: 1bind_master: 192.168.10.160manage_forward_zones: [test.com]manage_reverse_zones: [192.168.10]
B. DNS query: Vim/etc/cobbler/named. Template
1 listen-on port 53 { any; }2 allow-query { any; }
(5) set the NTP service: Vim/etc/NTP. conf
1 server 192.168.10.1602 fudge 192.168.10.160 stratum 10
(6) firewall settings
If iptables is enabled, ports UDP 53/67/69 and TCP 80/443/25151/8140 must be enabled;
(7) change the default system password (optional): Vim/etc/cobbler/settings
Default_password_crypted: "$1 $ mf86/uhc $ wvcicx2t6crbz2onwxyac." # The default value is "cobbler"
Use OpenSSL passwd-1 to reset the password;
(8) set TFTP: Vim/etc/xinetd. d/TFTP
Set the disable item to no;
(9) download get-loaders (the boot file mentioned earlier)
Cobbler get-loaders # automatically download the loaders file in the/var/lib/cobbler/loaders/directory
The readme file specifies the boot files required for different system architectures:
1 The requirements for netbooting each are as follows:2 3 x86/x86_64 require syslinux (pxelinux.0), and menu.c324 ppc/ppc64 use yaboot5 ia64 uses elilo
(10) Configure puppet:
A. Vim/etc/cobbler/setting
1 puppet_auto_setup: 12 sign_puppet_certs_automatically: 13 remove_ols_puppet_cert_automatically: 1
B. Modify the puppet configuration file: Vim/etc/puppet. conf.
1 [main] 2 logdir =/var/log/puppet 3 rundir =/var/run/puppet 4 ssldir = $ vardir/SSL 5 6 [Agent] 7 classfile = $ vardir/ classes.txt 8 localconfig = $ vardir/localconfig 9 server = cobbler. test. com10 certname = cobbler. test. com11 12 [Master] 13 certname = cobbler. test. com14 autosign =/etc/puppet/autosign. conf # automatic authentication configuration file
Create an automatic authentication file:
Touch/etc/puppet/autosign. confecho "* .test.com">/etc/puppet/autosign. conf # assume that the node host name deployed by cobbler is * .test.com
(11) start the service
1 /etc/init.d/puppetmaster start 2 chkconfig puppetmaster on 3 4 service cobblerd start 5 chkconfig cobblerd on 6 7 service httpd start 8 chkconfig httpd on 9 10 service xinetd start11 chkconfig xinetd on
# Cobbler sync automatically starts named and DHCPD
(12) cobbler setting Information Synchronization
cobbler sync
(13) cobbler check
cobbler check
NOTE: If SELinux is temporarily disabled, you can ignore the SELinux error prompt. For other information, such as port settings, debmirror, CMAN, and pykickstart;
So far: Cobbler installation is complete!
System Customization
1. Import the image:Image directory/mnt/CentOS-6.5-x86_64-bin-DVD1.iso
1 mkdir-P/mnt/centos6.52 Mount-o loop/mnt/CentOS-6.5-x86_64-bin-DVD1.iso/mnt/centos6.5/# Mount 3 cobbler import -- Path =/mnt/centos6.5/-- name = centos6.5
Note: the import process may take several minutes. You can view the/var/www/cobbler/ks_mirror/centos5.5/directory file generation or view the file in a browser;
2. View information
1 cobbler Report # view information 2 cobbler distro list # view the imported distro list. A profile3 cobbler profile list with the same name as distro is generated by default # view the profile list
Cobbler System Structure: distro --> profile --> system. You can customize the profile based on the imported distro, and then customize the system by the profile;
3. Customize the Kickstart file and sinppet File
For example, to deploy three types of nodes, control nodes, computing nodes, and storage nodes, you can customize the following three KS files (which can be easily defined using the graphic interface software system-config-kickstart)
Centos6.5-control.ksCentos6.5-compute.ksCentos6.5-storage.ks
The custom KS files are stored in/var/lib/cobbler/kickstart/* KS, And the custom snippet files are stored in/var/lib/cobbler/snippet;
You can reference a custom snippet In the KS file, so that no code snippets can be written together to form a huge KS file! Finally, the KS files called by the system will be parsed (copied) one by one from snippets );
4. Custom cobbler Profile
(1) control node Profile
1 cobbler profile add --name=centos6.5-control --kickstart=2 /var/lib/cobbler/kickstarts/centos6.5-control.ks --distro=centos6.5-x86_64
(2) computing node Profile
1 cobbler profile add --name=centos6.5-compute --kickstart=2 /var/lib/cobbler/kickstarts/centos6.5-compute.ks --distro=centos6.5-x86_64
(3) Storage node Profile
1 cobbler profile add --name=centos6.5-storage --kickstart=2 /var/lib/cobbler/kickstarts/centos6.5-storage.ks --distro=centos6.5-x86_64
(4) view the profile: Cobbler profile list
1 [[email protected] ~]cobbler profile list2 centos6.5-compute3 centos6.5-control4 centos6.5-storage
5 centos6.5-x86_64
5. Custom System
(1) Hardware discovery
Start all nodes to be deployed in sequence and start from PXE. A prompt is displayed, indicating that the IP address is obtained from the DHCP server;
Node network information (mainly IP address and MAC address) is stored in/var/lib/DHCPD. leases;
(2) system Customization
cobbler system add --name=node1 --mac=00:24:E8:64:24:59 --ip-address=192.168.10.161 --subnet=255.255.255.0 --gateway=192.168.10.5 --interface=eth0 --static=1 --if-gateway=192.168.10.5 --profile=centos6.5-control --name-servers-search=test.com --dns-name=node1.test.com --hostname=node1.test.com --netboot-enabled=true --name-servers=192.168.10.160
The name and Mac cannot be the same. Mac is the only credential specified to the node. -- DNS-name is critical. Cobbler writes the DNS-Name and IP address to the DNS record for DNS resolution;
(3) Restart all nodes, install the system, and complete puppet registration (which can be viewed on the cobbler node );
Reference link:
[1] http://zh.wikipedia.org/wiki/pre-start execution environment
[2] Zhang zifan, openstack deployment practices, people's post and telecommunications press, 2014
[3] http://docs.fedoraproject.org/en-US/Fedora/17/html/Installation_Guide/s1-netboot-pxe-config.html
[4] http://www.cobblerd.org/manuals/2.6.0/
[5] http://fedoraproject.org/wiki/Anaconda/Kickstart