Cobbler automatically deploys CentOS 6 and CentOS 7 in batches

Source: Internet
Author: User

Cobbler automatically deploys CentOS 6 and CentOS 7 in batches

Introduction to Cobbler

When using PXE for batch deployment, there is a defect that only a single operating system can be installed (the same version, only one kickstart file ). However, in the actual environment, servers with different functions need to be deployed in different environments, and cobbler meets this requirement. Cobbler is developed based on python and is a secondary encapsulation of PXE. It provides CLI and Web management forms, making operations and management easier. Similar to PXE, cobbler also requires services such as tftp, httpd, and dhcp. You can use yum to install cobbler. the tftp and httpd services are automatically installed during installation. The dhcp Service must be installed on its own.

Cobbler deployment is very simple. First, add distro, or directly import the CD image, and then add the kickstart file to a distro. One distro can have multiple kickstart files, to deploy multiple environments in the same operating system version.

Implementation Process

Lab environment: all services are deployed on the same server (192.168.3.10)

Install cobbler

[Root @ node1 ~] # Yum install cobbler

In this process, tftp and httpd are automatically installed.

Install dhcp on your own.

[Root @ node1 ~] # Yum install dhcp

Services such as tftp, httpd, dhcp, and DNS can be managed by cobbler or independently. All these services are managed separately.

[Root @ node1 ~] # Vim/etc/cobbler/settings

Manage_dhcp: 0

Manage_dns: 0

.....

Manage_tftpd: 0

Manage_rsync: 0

Configure dhcp Service

[Root @ node1 ~] # Cp/usr/share/doc/dhcp-4.1.1/dhcpd. conf. sample/etc/dhcp/dhcpd. conf

[Root @ node1 ~] # Vim/etc/dhcp/dhcpd. conf

......

......

Subnet 192.168.3.0 netmask 255.255.255.0 {

Range 192.168.3.10 192.168.3.254;

Option routers 192.168.3.1;

Option broadcast-address 192.168.3.31;

Default-lease-time 3600;

Max-lease-time 7200;

Next-server 192.168.3.10; # point to pxe server

Filename "pxelinux.0 ";

}

Check the configuration and start the service:

[Root @ node1 ~] # Service dhcpd configtest

Syntax: OK

[Root @ node1 ~] # Service dhcpd start

Starting dhcpd: [OK]

[Root @ node1 ~] # Ss-tunl | grep 67

Udp UNCONN 0 0 *: 67 *:*

Start tftp and rsync

[Root @ node1 ~] # Chkconfig tftp on

[Root @ node1 ~] # Chkconfig rsync on

[Root @ node1 ~] # Service xinetd start

[Root @ node1 ~] # Ss-tunl | grep 69

Udp UNCONN 0 0 *: 69 *:*

Start the cobbler Service

You must start the httpd service before starting cobbler.

[Root @ node1 ~] # Service httpd start

[Root @ node1 ~] # Service cobblerd start

Then use cobbler check to check the running environment of cobbler. the first running may have the following error ():

[Root @ node1 ~] # Cobbler check

The following are potential configuration items that you may be 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 shoshould 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 shoshould 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, shocould you want to support all ubuntures, shocould include pxelinux.0, menu. c32, elilo. efi, and yaboot. the 'cobbler get-loaders' command is the easiest way to resolve these requirements.

4: debmirror package is not installed, it will be required to manage debian deployments and repositories

5: ksvalidator was not found, install pykickstart

6: The default password used by the sample templates for newly installed machines (default_password_crypted in/etc/cobbler/settings) is still set to 'jobbler' and shocould be changed, try: "openssl passwd-1-salt 'random-phrase-here ''ur-password-here '" to generate new one

7: fencing tools were not found, and are 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.

Solve the preceding errors one by one:

1) set the server parameter to the IP address of the cobbler server

# Vim/etc/cobbler/settings

# Server: 192.168.3.10

2) Set next_server to the IP address of the pxe Server

# Vim/etc/cobbler/settings

# Next_server: 192.168.3.10

3) If you only provide services for servers in the x86/x86_64 architecture, install syslinux.

# Yum install syslinux

4) This item can be ignored.

5) install ksvalidator

# Yum install-y pykickstart

6) set a new password for the default_password_crypted Parameter

# Openssl passwd-1-salt 'openssl rand-hex 6'

# Default_password_crypted: "passwd"

7) install cman or fence-agents (optional)

After modification, restart the service:

[Root @ node1 ~] # Cobbler sync

[Root @ node1 ~] # Service cobblerd restart

Add distro

Attach a CD image

[Root @ node3 ~] # Mount/dev/cdrom/mnt/flash/

Add a distro (if you have a CD image, we recommend that you import it directly)

[Root @ node1 ~] # Cobbler import -- name = CentOS-6.5-x86_64 -- path =/mnt/flash/

[Root @ node1 ~] # Cobbler distro list

Centos-6.5-x86_64

If the image file is large, the import process will be long. After the import is complete, a directory named -- name will be generated under the/var/www/cobbler/ks_mirror Directory, which is consistent with the directory of the image mounted on the local disk.

Create a kickstart File

The preparation of the kickstart file is very simple.

First install system-config-kickstart.

[Root @ node1 ~] # Yum install system-config-kickstart

Execute system-config-kickstart to enable graphical interface configuration (use connection programs such as xmanager)

[Root @ node1 ~] # System-config-kickstart

The configuration process is similar to the installation of the operating system. Follow the prompts to configure the configuration one by one. Before configuration, You need to attach a CD image and use it as the local yum source. The Package Selection option displays software packages that can be installed on the CD image.

If the ks file of another operating system is configured, use the corresponding CD image file as the local yum source. For example, you need to create the ks file for centOS7.

Change to the ISO file of centos 7.

Add the local repo file in the/etc/yum. repos. d directory, clear the previous cache, and mount the file.

[Root @ CentOS-6 ~] # Yum clean all

Loaded plugins: fastestmirror, security

Cleaning repos:

Cleaning up Everything

Cleaning up list of fastest mirrors

[Root @ CentOS-6 ~] # Mount/dev/cdrom/mnt/flash/

Mount: block device/dev/sr0 is write-protected, mounting read-only

############################

Package Selection is the software Package on the centOS7 image disc. Note that system-config-kickstart does not support LVM. To add LVM, you must manually modify it in the ks file.

Add profile for distro

A kickstart file is provided for a distro to generate a specific system installation configuration. For example, add a kickstart file for the distro (centos-6.5-x86_64) You just added.

First, verify that the ks file has a syntax error, and then copy it to the specified directory to add:

[Root @ node1 ~] # Ksvalidator ks. cfg

[Root @ node1 ~] # Cp/root/ks. cfg/var/lib/cobbler/kickstarts/

[Root @ node1 ~] # Cobbler profile add -- name = centos-6.5-base -- distro = centos-6.5-x86_64 -- kickstart =/var/lib/cobbler/kickstarts/ks. cfg

##### Add a second profile

[Root @ node1 ~] # Cp/root/ks-mysql.cfg/var/lib/cobbler/kickstarts/

[Root @ node1 ~] # Cobbler profile add -- name = centos-6.5-mysql -- distro = centos-6.5-x86_64 -- kickstart =/var/lib/cobbler/kickstarts/ks-mysql.cfg

List to view the added profile:

[Root @ node1 kickstarts] # cobbler profile list

Centos-6.5-base

Centos-6.5-mysql

Centos-6.5-x86_64

After the addition is complete, run cobbler sync and then you can use it.

[Root @ node3 ~] # Cobbler sync

Test process

Add a new virtual machine without installing the operating system.

Select the desired version to start Installation

Cobbler deployment has been implemented...

For more details, please continue to read the highlights on the next page:

  • Install and configure Cobbler in CentOS 6.5
  • Cobbler remote CentOS Installation
  • Cobbler batch installation of Ubuntu/CentOS Systems
  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.