Tutorial on installation and configuration of cobbler under CentOS

Source: Internet
Author: User
Tags change settings mkdir ssh centos iptables rsync ssh port

Cobbler is a fast network-installed Linux service, and can be adjusted to support network installation of Windows. The tool is developed using Python, small and lightweight (15k line of Python code), with simple commands to complete the configuration of the PXE network installation environment, while also managing DHCP, DNS, as well as Yum warehouses, the construction system ISO image.

Cobbler supports command line management, web interface management, and API interface, which can be easily used for two times.

Cobbler client Koan supports virtual machine installation and operating system reinstallation to make reloading systems more convenient.

Features provided by cobbler

With cobbler, you can install a machine without manual intervention. Cobbler sets up a PXE boot environment (which also uses Yaboot to support PowerPC) and controls all aspects of the installation, such as network boot services (DHCP and TFTP) and repository mirroring. When you want to install a new machine, cobbler can:

Configure the DHCP service using a previously defined template (if administrative DHCP is enabled)

Create a mirror or extract a medium for a repository (yum or rsync) to register a new operating system

Create an entry in the DHCP configuration file for the machine that you want to install and use the parameters you specify (IP and MAC address)

Create the appropriate PXE file under the TFTFP service directory

Restart the DHCP service to reflect changes

Reboot the machine to start the installation (if power management is enabled)

Cobbler supports numerous distributions: Red Hat, Fedora, CentOS, Debian, Ubuntu, and SuSE. When adding an operating system (usually by using an ISO file), cobbler knows how to extract the appropriate files and adjust the network service to properly boot the machine.

Cobbler can use the Kickstart template. Systems based on Red Hat or Fedora use Kickstart files to automate the installation process. By using a template, you will have a basic kickstart template, and then define how to replace the variables in one configuration file or machine configuration. For example, a template might contain two variables $domain and $machine _name. In the Cobbler configuration, a configuration file specifies Domain=mydomain.com, and each machine that uses the profile specifies its name in the machine_name variable. All machines in this configuration file use the same kickstart installation and are configured for domain=mydomain.com, but each machine has its own machine name. You can still use the Kickstart template to install other machines in different domains and use different machine names.

To assist with the management system, cobbler can be connected to a variety of power management environments through fence scripts. Cobbler supports APC_SNMP, BladeCenter, Bullpap, Drac, Ether_wake, ILO, Integrity, Ipmilan, Ipmitool, Lpar, RSA, Virsh, and WTI. To reinstall a machine, run the reboot system foo command, and cobbler will use the necessary credentials and information to run the appropriate fence scripts (such as the number of machine slots) for you.

In addition to these features, you can use a configuration management system (CMS). You have two options: an internal system within the tool, or an existing external CMS, such as Chef or Puppet. With internal systems, you can specify file templates that are processed according to configuration parameters (as the Kickstart template is handled), and then copied to the location you specify. This is useful if you must automatically deploy the configuration file to a specific machine.

With the Koan client, cobbler can configure the virtual machine from the client and reinstall the system. I will not discuss configuration management and Koan features because they are outside the scope of this article. However, they are useful features worth studying.

Cobbler How to install and configure:

One, loading Epel source

The code is as follows:

RPM-IVH http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm

Second, install Cobbler

1.yum files required for installation

The code is as follows:

Yum-y Install Tftp-server Cobbler cobbler-web pykickstart debmirror httpd python-ctypes xinetd rsync

2. Check that the Cobbler configuration is correct

The code is as follows:

Cobbler Check

3. Change settings configuration file

The code is as follows:

Vi/etc/cobbler/settings

NEXT_SERVER:DHCP server Address

Server:cobbler server Address

Manage_dhcp:1

Manage_rsync:1

4. Close Iptables and SELinux

The code is as follows:

/etc/init.d/iptables stop

Setenforce 0

5. Set up TFTP and rsync services

The code is as follows:

Vi/etc/xinetd.d/tftp

Disable Yes => disable No

< P>vi/etc/xinetd.d/rsync

Disable Yes => disable No

6. Set CentOS System Password

The code is as follows:

OpenSSL passwd-1-salt ' cobbler ' cobbler '

7. Download Fedora's loader information

The code is as follows:

Cobbler Get-loaders

8. Modify the DHCP configuration template file. Need a host of things the DHCP address needs to be assigned and the native address must be on the same network segment otherwise it cannot start DHCP

The code is as follows:

Ddns-update-style Interim;

Allow booting;

Allow BOOTP;

Ignore client-updates;

Set vendorclass = option Vendor-class-identifier;

#修改为自己的网段

Subnet 192.168.0.0 netmask 255.255.255.0 {

#修改路由地址

Option routers 192.168.0.1;

#域名服务器地址

Option Domain-name-servers 202.106.0.20;

#子网

Option Subnet-mask 255.255.255.0;

#分配IP地址段

Range DYNAMIC-BOOTP 192.168.0.100 192.168.0.254;

FileName "/pxelinux.0";

Default-lease-time 21600;

Max-lease-time 43200;

Next-server $next _server;

}

Third, import mirror to Cobbler

1. Create a mirrored mount point directory

The code is as follows:

Mkdir-p/mnt/foo

2. Mount the ISO image to the created directory (the ISO image you can customize for yourself)

The code is as follows:

Mount-o Loop Centos-6.4-x86_64-mini.iso/mnt/foo

3. Import the OS from the mount point directory and name it Centos6.4_mini arch=x86_64

The code is as follows:

Cobbler Import--path=/mnt/foo--name=centos6.4_mini--arch=x86_64

4. Specify Kickstart file (optional default we will specify a custom kickstart file)

The code is as follows:

Cobbler profile Edit--name=centos6.4_mini-x86_64--kickstart= file path

5. View Cobbler Report

The code is as follows:

Cobbler

Distribution:centos6.4_mini-x86_64

Enable gpxe? : 0

Enable PXE Menu? : 1

Fetchable Files: {}

Kernel Options: {}

Kernel Options (Post Install): {}

Kickstart:/VAR/LIB/COBBLER/KICKSTARTS/SAMPLE_END.KS

Kickstart Metadata: {}

Management Classes: []

Management Parameters: < >

Name Servers: []

Name Servers Search Path: []

Owners: [' admin ']

Parent Profile:

Proxy:

Red Hat Management Key: < >

......

6. View the imported mirrors list

The code is as follows:

Cobbler distro List

7. Cobbler is effective

The code is as follows:

Cobbler Sync

8. Reboot into network boot system

9. It is necessary to note that every configuration change requires the execution of Cobbller sync

Iv. Kickstart files (take my profile as an example)

The code is as follows:

Firewall--disabled

Install

#cdrom

ROOTPW--iscrypted $default _password_crypted

Auth--useshadow--passalgo=md5

Text

Firstboot--disable

Keyboard US

Lang en_US. UTF-8

URL--url= $tree

$yum _repo_stanza

$SNIPPET (' Network_config ')

< P>selinux--disabled

# does not configure the X Window System

Skipx

Logging--level=info

#reboot--eject

TimeZone Asia/shanghai

#network--device em1--bootproto=static--ip=192.168.7.123--netmask=255.255.248.0--gateway=192.168.0.1-- NameServer 8.8.8.8--hostname=test--onboot=yes

Bootloader--LOCATION=MBR--DRIVEORDER=SDA

< p># clear the Master Boot record

ZEROMBR Yes

< p># Partition clearing information

Clearpart--all--initlabel

< p># Disk Partitioning information

Part/--fstype= "EXT4"--size=10240

Part swap--size=4096

Part/data--fstype= "Ext4"--grow--size=1

< p>

%packages

@base

@core

@server-policy

Sgpio

Device-mapper-persistent-data

Ntp

< p>

%post--nochroot

Mkdir-p/mnt/sysimage/tmp/custom_data >>/tmp/custom.log 2>&1

Cp/mnt/source/packages/lnmp_pack.tar.gz/mnt/sysimage/tmp/custom_data >>/tmp/custom.log 2>&1

Cp/mnt/source/packages/install_packages.sh/mnt/sysimage/tmp/custom_data >>/tmp/custom.log 2>&1

Cp/mnt/source/packages/ncftp-3.2.5-src.tar.gz/mnt/sysimage/tmp/custom_data >>/tmp/custom.log 2>&1

Cp/mnt/source/packages/rarlinux-3.8.0.tar.gz/mnt/sysimage/tmp/custom_data >>/tmp/custom.log 2>&1

Cp/mnt/source/packages/nmon_linux_14i.tar.gz/mnt/sysimage/tmp/custom_data >>/tmp/custom.log 2>&1

< p>

%post

Cd/tmp/custom_data >>/tmp/custom.log 2>&1

chmod +x install_packages.sh

SH install_packages.sh

< p>

# Remove Custom_data

Rm-rf/tmp/custom_data

< p>

#vim syntax on

echo alias vi= ' vim ' >>/ETC/BASHRC

< p># disable IPv6

echo "Alias net-pf-10 off" >>/etc/modprobe.d/dist.conf

Echo-e "optionstipv6tdisable=1" >>/etc/modprobe.d/dist.conf

echo "Networking_ipv6=no" >>/etc/sysconfig/network

< p> #append Lib

echo "/usr/local/lib/" >>/etc/ld.so.conf

< p> #modify Lang

echo ' Export LANG=ZH_CN. UTF8 ' >>/etc/profile

< p> #disable System Auto Mail

echo "unset mailcheck" >>/etc/profile

< p> #modify History

echo ' Export histtimeformat= '%F%T ' whoami ' ' >>/etc/profile

Sed-i "s/histsize=1000/histsize=999999999/"/etc/profile

< p> #modifu ssh port on 3389

Echo ' Port 3389 ' >>/etc/ssh/sshd_config

Echo ' Usedns no ' >>/etc/ssh/sshd_config

< p>

For i in ' ls/etc/rc3.d/s* '

Todo

Cursrv= ' echo $i |cut-c 15-'

Chkconfig--level 3 $CURSRV off

Done

< p>for i in Crond rsyslog iptables network ntpd sshd sysstat;do chkconfig--level 3 $i On;done

< P>sed-i '/hostname=/d '/etc/sysconfig/network

Echo ' Hostname=test ' >>/etc/sysconfig/network

< p>

< p># Sysctl

echo "Net.core.netdev_max_backlog = 32768" >>/etc/sysctl.conf

echo "Net.core.rmem_default = 8388608" >>/etc/sysctl.conf

echo "Net.core.rmem_max = 16777216" >>/etc/sysctl.conf

echo "net.core.somaxconn = 32768" >>/etc/sysctl.conf

echo "Net.core.wmem_default = 8388608" >>/etc/sysctl.conf

echo "Net.core.wmem_max = 16777216" >>/etc/sysctl.conf

echo "Net.ipv4.ip_local_port_range = 5000 65000" >>/etc/sysctl.conf

echo "net.ipv4.tcp_fin_timeout = >>/etc/sysctl.conf"

echo "net.ipv4.tcp_keepalive_time =" >>/etc/sysctl.conf

echo "Net.ipv4.tcp_max_orphans = 3276800" >>/etc/sysctl.conf

echo "Net.ipv4.tcp_max_syn_backlog = 65536" >>/etc/sysctl.conf

echo "net.ipv4.tcp_max_tw_buckets = 5000" >>/etc/sysctl.conf

echo "Net.ipv4.tcp_mem = 94500000 915000000 927000000" >>/etc/sysctl.conf

echo "net.ipv4.tcp_syn_retries = 2" >>/etc/sysctl.conf

echo "net.ipv4.tcp_synack_retries = 2" >>/etc/sysctl.conf

echo "net.ipv4.tcp_syncookies = 1" >>/etc/sysctl.conf

echo "net.ipv4.tcp_timestamps = 0" >>/etc/sysctl.conf

echo "net.ipv4.tcp_tw_recycle = 1" >>/etc/sysctl.conf

echo "Net.ipv4.tcp_tw_reuse = 1" >>/etc/sysctl.conf

/sbin/sysctl-p

< p># Modify Core ULIMT

Echo-e "*tsofttnofilet65535" >>/etc/security/limits.conf

Echo-e "*thardtnofilet65535" >>/etc/security/limits.conf

< P>ECHO-E "*tsofttnofilet65535" >>/etc/security/limits.d/90-nproc.conf

Echo-e "*thardtnofilet65535" >>/etc/security/limits.d/90-nproc.conf

< p># ntpd

Cat >/etc/sysconfig/clock <

Zone= "Asia/shanghai"

Utc=true

Arc=false

Eof

/sbin/service ntpd Stop

/usr/sbin/ntpdate 210.167.182.10

/sbin/service ntpd Start

< P>commit

Eof

< P>%end

[/python]

< P>[python]

# visit Cobbler_web

Http://IP/cobbler_web

[/python]

Five. Summary of the error

When the following information solution appears

The code is as follows:

[Python]

1:some network boot-loaders are missing from/var/lib/cobbler/loaders

2:comment out ' dists ' on/etc/debmirror.conf for proper Debian support

3:comment out ' arches ' on/etc/debmirror.conf for proper Debian support

[/python]

Workaround:

The code is as follows:

[Python]

1.cobbler get-loaders

2-3: Yun Install debmirror && vi/etc/debmirror.conf

@dists = "Sid" => # @dists = "Sid"

@arches = "i386" => # @arches = "i386"

Related Article

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.