Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation and configuration of Cobbler under CentOS

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "the installation and configuration of Cobbler under CentOS". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Cobbler is a fast network installation linux service, and can also be adjusted to support network installation of windows. The tool uses python development, small and light (only 15k lines of python code), you can use a simple command to complete the configuration of the PXE network installation environment, but also can manage DHCP, DNS, and yum warehouse, construct system ISO images.

Cobbler supports command line management, web interface management, and provides an API interface, which is convenient for secondary development.

The Cobbler client Koan supports virtual machine installation and operating system reinstallation, making it easier to reinstall the system.

Features provided by cobbler

With Cobbler, you can install the machine without human intervention. Cobbler sets up a PXE boot environment (it can also use yaboot to support PowerPC) and controls all aspects related to installation, such as network boot services (DHCP and TFTP) and repository images. When you want to install a new machine, Cobbler can:

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

Mirror a repository (yum or rsync) or extract a medium to register a new operating system

Create an entry in the DHCP configuration file for the machine that needs to be installed, 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 the changes

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

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

Cobbler can use kickstart templates. Red Hat or Fedora-based systems use kickstart files to automate the installation process. By using templates, you have a basic kickstart template and then define how to replace the variables in it for a 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 are installed with the same kickstart and 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 in managing the system, Cobbler can connect to various 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 for you (such as the number of machine slots).

In addition to these features, a configuration management system (CMS) can be used. You have two choices: an internal system within the tool, or integrate an existing external CMS, such as Chef or Puppet. With the internal system, you can specify file templates that are processed according to configuration parameters (in the same way as kickstart templates), and then copied to the location you specify. This feature is useful if you must automatically deploy the configuration file to a specific machine.

Using the koan client, Cobbler can configure the virtual machine and reinstall the system from the client. I won't discuss configuration management and koan features because they are outside the scope of this article. However, they are useful features worth studying.

How to install and configure Cobbler:

1. Load 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

Files required for 1.yum installation

The code is as follows:

Yum-y install tftp-server cobbler cobbler-web pykickstart debmirror httpd python-ctypes xinetd rsync

two。 Check whether the cobbler configuration is correct

The code is as follows:

Cobbler check

3. Change settings profile

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

Vi / etc/xinetd.d/rsync

Disable yes = > disable no

6. Set the centos system password

The code is as follows:

Openssl passwd-1-salt 'Cobbler'' cobbler'

7. Download loader information for fedora

The code is as follows:

Cobbler get-loaders

8. Modify the dhcp configuration template file. The dhcp address assigned by the host needs to be on the same network segment as the local address, otherwise dhcp cannot be started.

The code is as follows:

Ddns-update-style interim

Allow booting

Allow bootp

Ignore client-updates

Set vendorclass = option vendor-class-identifier

# modify it to your own IP address range

Subnet 192.168.0.0 netmask 255.255.255.0 {

# modify routing address

Option routers 192.168.0.1

# Domain name server address

Option domain-name-servers 202.106.0.20

# Subnet

Option subnet-mask 255.255.255.0

# assign IP address range

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

}

3. Import images to cobbler

1. Create an image mount point directory

The code is as follows:

Mkdir-p / mnt/foo

two。 Mount the iso image to the created directory (you can customize the iso image for yourself)

The code is as follows:

Mount-o loop CentOS-6.4-x86_64-mini.iso / mnt/foo

3. Import 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 the 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 report

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 list of imported images

The code is as follows:

Cobbler distro list

7. It is cobbler that takes effect

The code is as follows:

Cobbler sync

8. Restart access to the network boot system

9. It should be noted that cobbller sync is required for every configuration change.

4. Kickstart file (take my configuration file 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')

Selinux-disabled

# Do 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

# Clear the Master Boot Record

Zerombr yes

# Partition clearing information

Clearpart-all-initlabel

# Disk partitioning information

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

Part swap-size=4096

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

% packages

@ base

@ core

@ server-policy

Sgpio

Device-mapper-persistent-data

Ntp

% 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

% post

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

Chmod + x install_packages.sh

Sh install_packages.sh

# remove custom_data

Rm-rf / tmp/custom_data

# vim syntax on

Echo alias vi='vim' > > / etc/bashrc

# disable ipv6

Echo "alias net-pf-10 off" > > / etc/modprobe.d/dist.conf

Echo-e "options\ tipv6\ tdisable=1" > > / etc/modprobe.d/dist.conf

Echo "NETWORKING_IPV6=no" > > / etc/sysconfig/network

# append lib

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

# modify lang

Echo 'export LANG=zh_CN.UTF8' > > / etc/profile

# disable system auto mail

Echo "unset MAILCHECK" > > / etc/profile

# modify history

Echo 'export HISTTIMEFORMAT= "F% T `whoami`" > > / etc/profile

Sed-I "s/HISTSIZE=1000/HISTSIZE=999999999/" / etc/profile

# modifu ssh port on 3389

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

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

For i in `ls / etc/rc3.d/S* `

Do

CURSRV= `echo $I | cut-c 15-`

Chkconfig-- level 3$ CURSRV off

Done

For i in crond rsyslog iptables network ntpd sshd sysstat;do chkconfig-- level 3$ I on;done

Sed-I'/ HOSTNAME=/d' / etc/sysconfig/network

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

# 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 = 30" > > / etc/sysctl.conf

Echo "net.ipv4.tcp_keepalive_time = 300" > > / 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

# modify core ulimt

Echo-e "*\ tsoft\ tnofile\ t65535" > > / etc/security/limits.conf

Echo-e "*\ thard\ tnofile\ t65535" > > / etc/security/limits.conf

Echo-e "*\ tsoft\ tnofile\ t65535" > > / etc/security/limits.d/90-nproc.conf

Echo-e "*\ thard\ tnofile\ t65535" > > / etc/security/limits.d/90-nproc.conf

# ntpd

Cat > / etc/sysconfig/clock # @ arches= "i386"

This is the end of the content of "how to install and configure Cobbler under CentOS". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report