Automatic deployment and installation of Cobbler based on Linux

Automatic deployment and installation of Cobbler based on Linux

Cobbler is an open source project developed using Python. It provides a fully automated and batch network installation environment for quickly establishing a Linux system by concentrating all the services involved in the deployment system.

Experiment preparation

  • A Linux server (Centos7 system, IP: 192.168.241.3)
  • A blank virtual machine
  • Need to connect to the Internet, all virtual machines use NAT mode
  • release-latest-7.noarch.rpm package

Cobbler automatic installation steps

1. Import epel source

rpm --ivh epel-release-latest-7.noarch.rpm—————— install dependent packages

yum list———————— Automatically load online update source

Insert picture description here

2. Install Cobbler and related service packages

yum install -y cobbler dhcp tftp-server pykickstart httpd rsync xinetd

cobbler: used to quickly establish a Linux network installation environment

dhcp: used to automatically assign IP addresses to blank hosts

tftp-server: Provides the download of boot image files

pykickstart: Implement unattended installation

httpd: run as a console program

rsync: realize data synchronization

xinetd: Provides access control, enhanced log and resource management functions

Insert picture description here

3. Modify the cobbler main configuration file

vim /etc/cobbler/settings

Modify the following items

next_server:192.168.241.3——————Point to the ip of the tftp server, which is the local ip address

Insert picture description here

server:192.168.241.3———————— The ip pointing to the cobbler server, that is, the local ip address

Insert picture description here

manage_dhcp: 1—————————— Let cobbler manage dhcp service

Insert picture description here

manage_rsync: 1———————— Let cobbler manage the rsync service

manage_tftp: 1—————————— Let cobbler manage tftp service

Insert picture description here

4. Start related services and close the firewall and selinux

systemctl start httpd.service—————— open http service

systemctl start cobblerd.service——————Start cobbler service

systemctl stop firewalld

setenforce 0
Insert picture description here

5. Use the cobbler check command to check the settings of Cobbler, and query items that need to be changed.

cobbler check

Insert picture description here

6. Turn on the tftp service and rsync service

Modify the configuration file of tftpd

vim /etc/xinetd.d/tftp

Open service

systemctl restart xinetd.service

systemctl start rsyncd.service

7. Download the boot operating system file

cobbler get-loaders

Insert picture description here

8. Set the initial password of the Cobbler user

Use salt encryption to generate keys

openssl passwd -1 -salt ‘abc123’ ‘abc123’

The first quotation mark: any character can be written casually

The second quotation mark: the password of the root user after installing the system

Add the generated key to the Cobbler configuration file

vim /etc/cobbler/settings

Insert picture description here

9. Configure dhcp service

Modify the template file of Cobbler management dhcp service

vim /etc/cobbler/dhcp.template

subnet 192.168.241.0 netmask 255.255.255.0 {

option routers 192.168.241.2;——————Modify the gateway

option domain-name-servers 192.168.241.2;—————— Modify DNS, if the network card is in dhcp mode, you can query the DNS address through nslookup 127.0.0.1 | grep server

option subnet-mask 255.255.255.0;

range dynamic-bootp 192.168.241.100 192.168.241.200;————Modify the address pool

Insert picture description here

Synchronize the configured template file to the configuration file of the DHCP service

cobbler sync

Insert picture description here

Restart the DHCP service

systemctl restart dhcpd.service

10. Import ISO image file

Mount image file

mount /dev/sr0 /mnt

Insert picture description here

Import the Linux kernel in the iso image and initialize the image file

cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64

Parameter Description:

--Path: indicates the directory where the mirror is mounted

--Name: indicates the name defined for the installation source

-Atch: indicates the number of system bits of the specified installation source

The default import storage path is /var/www/cobbler/ks_mirror/CentOS-7-x86_64

Insert picture description here

11. Restart all services

systemctl restart cobblerd.service

systemctl restart dhcpd.service

systemctl restart xinetd.service

systemctl restart httpd.service

Insert picture description here

12. Use cobbler check again to check settings for Cobbler

Insert picture description here

13. After all configurations are completed, turn on the blank host to automatically install the system

Insert picture description here

Insert picture description here

This installation method is a minimal installation, and the installed system only has a character interface

Login account: root

Password: abc123

Guess you like

Origin blog.csdn.net/weixin_51432789/article/details/111035677