Mass deployment of Linux services of cobbler articles

A, Cobbler Introduction:
Cobbler provided and managed by a server installation tasks involved together, thereby simplifying the system configuration. Cobbler equivalent encapsulates DHCP, TFTP, XINTED services, a combination of PXE, kickstart installation method, etc., can be automated installation of the operating system and may provide multiple versions of the same time, in order to achieve the online system install different versions.

1.1 cobbler related services
DHCP: DHCP (Dynamic Host Configuration Protocol , Dynamic Host Configuration Protocol) is a network protocol LAN, using the UDP protocol works, there are two main purposes: to automatically assign IP addresses to the internal network or network service providers to internal users or network administrators as a means for central management of all computers. DHCP has three ports, and wherein UDP67 UDP68 normal DHCP service ports, respectively, as the DHCP Server and DHCP Client service port; 546 ports for DHCPv6 Client, and not for the DHCPv4, failover for the DHCP service, which is required special open service, DHCP failover is used to make "hot standby" in.
TFTP: TFTP is a special file transfer protocol. Relative to the current FTP and often use SFTP, TFTP is a simple file transfer based on TCP / IP protocol suite, it is used to provide a simple, low-overhead transmission services. TFTP port is set to 69.
With respect to the common FTP, TFTP has two good advantage:
1.TFTP based on UDP protocol, TCP protocol if the environment is not, it is more appropriate;
2.TFTP small code footprint and memory than the execution;
By default, Linux is an internal tftp server package is installed. But the default is not activated.
 
PXE: Pre-Boot Execution Environment (Preboot eXecution Environment, PXE, also known as Pre-Execution Environment) provides a mechanism for using the network interface (Network Interface) boot the computer. This mechanism lets you start your computer can not rely on local data storage devices (like hard disks) or locally installed operating system.
Initially, it was as part of the Intel PXE cable management system, Intel and Systemsoft 1999 September 20 announced its specification (version 2.1) [1]. By using as an Internet Protocol (IP), User Datagram Protocol (UDP), Dynamic Host Configuration protocol (DHCP), Trivial File Transfer Protocol (TFTP) and other types of network protocols and globally unique identifier (GUID), general-purpose network driver concept universal unique identifier (UUID) Interface (UNDI) and the object is achieved by the client (via PXE self-test computer) firmware extensions preset API.

Second, the interaction process:
1. Configuring the bare boot from the network after power on request broadcast packet DHCP server (cobbler server) which transmits a good distribution of the IP
2.DHCP server (cobbler server) transmits responese receipt of the request, including which ip address
3. get ip bare request before sending the file to the OS boot Server Cobbler
4.cobbler name Server tells bare OS boot files and the TFTP server ip and Port
5. the bare metal by the above TFTP server address informed communication port, the boot file download
6. bare execution of the boot file, determining loading information, select the os to install, cobbler server requests will come back during a kickstart file and Image os
7.cobbler Server kickstart transmission request and Iamge os
. 8. bare metal loading kickstart file
9. bare metal receiving os image, mounting the os image
system environment and ready to download cobbler

2.1 System environment 
open two network cards. Only a master mode, a bridge mode, host mode cobbler provide internal services.

[root@wusir ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:13:a1:49 brd ff:ff:ff:ff:ff:ff
inet 192.168.4.190/24 brd 192.168.4.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe13:a149/64 scope link
valid_lft forever preferred_lft forever
. 3: eth1: <BROADCAST, the MULTICAST, the UP, LOWER_UP> MTU 1500 qdisc allows users to pfifo_fast State the UP Group default of qlen 1000
Link / ether 00: 0c: 29: 13 is: A1: 53 is brd FF: FF: FF: FF: FF: FF
inet Global noprefixroute brd 192.168.182.255 scope 192.168.182.128/24 Dynamic eth1
valid_lft 1786sec 1786sec preferred_lft
inet6 FE80 :: 7073: 2021: e866: 204f / 64 Link noprefixroute scope
valid_lft Forever Forever preferred_lft
system version: CentOS Linux release 7.5.1804 (Core)
intranet IP: 192.168.182.128/24 # for internal communication, providing service cobbler
external network IP: 192.168.4.190/24 # is connected to external networks
2.2 Close security services
[root @ wusir ~] # systemctl stop firewalld # Close firewall
[ root @ wusir ~] # setenforce 0 # Close selinux

2.3 cobbler and download the required service program
[wusir the root @ ~] # yum the install cobbler TFTP DHCP-Server the syslinux the httpd -Y xinetd
the syslinux: providing pxelinux.0 this document, the guide boot files pxelinux.0 two startup files vmlinux and initrd
cobbler yum installation requires the following two sources, we can copy the code below the storage facility to their yum
[EPEL]
name = EPEL
Enabled. 1 =
gpgcheck = 0
BaseURL = HTTPS: //mirrors.aliyun.com/epel/ . 7 / the x86_64 /
[CentOS]
name = CentOS Base
Enabled. 1 =
gpgcheck = 0
BaseURL = HTTP: //mirrors.163.com/centos/7/os/x86_64/

三、配置相关服务
第一步:配置DHCP服务
[root@wusir ~]# cat /etc/dhcp/dhcpd.conf
subnet 192.168.182.0 netmask 255.255.255.0 {
range 192.168.182.150 192.168.182.155;
default-lease-time 600;
max-lease-time 7200;
filename "pxelinux.0";
}
[root@wusir ~]# systemctl restart dhcpd
第二步:配置tftp
[root@wusir ~]# cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
= dgram socket_type
Protocol UDP =
the wait = Yes
User = the root
Server = /usr/sbin/in.tftpd
the server_args = -s / var / lib / tftpboot
disable = #yes NO to NO
per_source =. 11
CPS 100 = 2
the flags = the IPv4
}
[wusir the root @ ~] # systemctl the restart xinetd
third step: start cobbler
[wusir the root @ ~] # systemctl Status cobblerd
fourth step: start the httpd
[wusir the root @ ~] # systemctl the restart the httpd
step 5: check the configuration cobbler
[root @ wusir ~] # Cobbler the Check
at The following are potential May the Configuration items that you 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 should 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 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 : enable and start rsyncd.service with systemctl
5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
6 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-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.
According to the above feedback, you need to modify one by one in order to continue
to modify the configuration file / etc / cobbler / settings
   One problem:
Cobbler files by default is the local loopback address 127.0.0.1, need to change cobbler to provide services ip address 192.168.182.128, 384 in line
384 server: 192.168.182.128
  question two:
netx_server also the default local loopback address 127.0.0.1, you need to modify the ip address provided cobbler services 192.163.182,128 out in line 272
272 next_server: 192.168.182.128
    question three:
negligible
   question 4:
start to rsync
[root @ wusir ~] # systemctl restart rsyncd
[root @ wusir ~] # systemctl enable rsyncd
question 5:
negligible
question six:
change password
[root ~ @wusir] -1 -salt # OpenSSL the passwd "123" "123456"
$ $ 123 $ 7mft0jKnzzvAdU4t0unTG1. 1
 
and the newly generated encrypted data to fill into the / etc / cobbler / settings
101 default_password_crypted: "$ 1 $ 123 $ 7mft0jKnzzvAdU4t0unTG1"
Question seven:
can be ignored
 
after more than solve the problem, need to synchronize and restart
[root @ wusir ~] # systemctl restart cobblerd
[root @ wusir ~] # Cobbler Sync
again to check whether the changes are complete
Created symlink /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service from.
[root @ wusir ~] # Cobbler the Check
at The following are the Configuration potential items that you You may want to fix:

1 : 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.
2 : debmirror package is not installed, it will be required to manage debian deployments and repositories
3 : 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.
'Ve finished changing!
Step Six: data lead and mount the CD
mount the CD
[root @ wusir ~] # mount / dev / cdrom / mnt
data lead (takes some time)
[the root wusir @ ~] # = --path Cobbler Import / mnt = --name "centos7.5"
Task Started: 2019-03-13_001927_import
Task Started (ID = Import Media, Time = 13 is Wed-Mar 2019 00:19:27)
Found Candidate A Signature: RedHat = Breed, Version = rhel6,
Found Candidate Signature A: RedHat = Breed, Version = rhel7
Found Signature matching A: RedHat = Breed, Version = rhel7
Adding path from the distros /var/www/cobbler/ks_mirror/centos7.5:
Creating new new Distro: centos7.5 the x86_64-
Trying symlink: /var/www/cobbler/ks_mirror/centos7.5 -> /var/www/cobbler/links/centos7.5-x86_64
creating new profile: centos7.5-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/centos7.5 for centos7.5-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos7.5
need to process repo/comps: /var/www/cobbler/ks_mirror/centos7.5
looking for /var/www/cobbler/ks_mirror/centos7.5/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos7.5/repodata
*** TASK COMPLETE ***
查看distro
[root@ken ~]# cobbler distro list
centos7.5-x86_64
查看profile
[root@wusir ~]# cobbler profile list
centos7.5-x86_64
distro: release, what is the name we installed version of linux operating system for a while we will import a Distro.
Profile: similar to a configuration file, similar to your bash_profile, which contains you can add kernel parameters corresponding kickstart file this profile corresponding distro and the like.
step VII: preparation kickstart file
to find the ks file in the root directory, and move to / var / lib / cobbler / kickstarts / directory renamed to the ks.cfg
[wusir root @ ~] Music Videos-Anaconda the ks.cfg /var/lib/cobbler/kickstarts/ks.cfg #
[@ wusir the root ~] # Vim /var/lib/cobbler/kickstarts/ks.cfg
[wusir the root @ ~] # CAT / var / lib / Cobbler / kickstarts / ks.cfg
# Version = DEVEL
# the Authorization Information System
auth --enableshadow --passalgo = SHA512
# the Use Media Installation CDROM
url --url = HTTP: //192.168.182.128/cobbler/ks_mirror/centos7. 5 / # here need to change the http address repodata where
# the Use the Graphical install
the Graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
# Network information
network --bootproto=dhcp --device=ens33 --ipv6=auto --no-activate
network --hostname=localhost.localdomain
# Root password
rootpw --iscrypted $6$7zu1wIUDgBGEFV1Y$KsLVeaGmyN92.QHr1fqKdTqPu8PDmd8K9V/s3Ru8NxE53NZz4gQKsmP6K0udcXVvDtponekICYUwBD7tYZJqU/
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
%packages
@^minimal
@core
%end
%addon com_redhat_kdump --disable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
第八步:自定义profile
[root@wusir ~]# cobbler profile add --distro=centos7.5-x86_64 --name=centos7.5_ken --kickstart=/var/lib/cobbler/kickstarts/ks.cfg
[root@wusir ~]# cobbler sync
task started: 2019-03-13_002724_sync
task started (id=Sync, time=Wed Mar 13 00:27:24 2019)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/centos7.5-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/images/centos7.5-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
copying distros to tftpboot
copying files for distro: centos7.5-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos7.5/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos7.5-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos7.5/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos7.5-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: centos7.5-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos7.5/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos7.5-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos7.5/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos7.5-x86_64/initrd.img
Writing template files for centos7.5-x86_64
rendering TFTPD files
generating /etc/xinetd.d/tftp
processing boot_files for distro: centos7.5-x86_64
cleaning link caches
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.manage_genders
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE *** 
第九步:查看profile
[root@wusir ~]# cobbler profile list
centos7.5-x86_64
centos7.5_ken
第十步:删除不包含ks文件的profile
[root@wusir ~]# cobbler profile remove --name=centos7.5-x86_64
[root @ wusir ~] # cobbler Profile List
centos7.5_ken
four, cobbler automated installation and testing
to create a new virtual machine, the host server's needs and cobbler cobbler server mode with a virtual network that is set above us. G memory requires three or more.

Guess you like

Origin www.cnblogs.com/renyz/p/11328874.html