Liunx's Cobbler automatic deployment installation

Cobbler automatically deploys and installs

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.80.134)
  • A blank virtual machine
  • Need to connect to the Internet, and all virtual machines use NAT mode.
    Related software package: link: https://pan.baidu.com/s/1HfwJtUD41oNtDePdMfS4ug Password: desg

Cobbler automatic installation service construction steps

1. Import epel source
rpm –ivh epel-release-latest-7.noarch.rpm	#安装依赖包
yum list				#自动加载在线更新源

Pack the installation into the opt directory
Insert picture description here

Insert picture description here

2. Install Cobbler and its related service packages
yum install -y cobbler dhcp tftp-server pykickstart httpd rsync xinetd 

#各软件作用如下
#cobbler		用来快速建立Linux网络安装环境
#dhcp		用来为空白主机自动分配IP地址
#tftp-server	提供引导镜像文件的下载
#pykickstart	实现无人值守安装
#httpd		作为控制台程序运行
#rsync		实现数据同步
#xinetd		提供访问控制、加强的日志和资源管理功能

Insert picture description here

3. Modify the main cobbler configuration file
vim /etc/cobbler/settings
#修改以下几项
next_server: 192.168.80.10       	#指向tftp服务器的IP,即本机IP
server: 192.168.80.10				#指向cobbler服务器的IP,即本机IP
manage_dhcp: 1                 		#让cobbler管理dhcp服务
manage_rsync: 1					#让cobbler管理rsync服务
manage_tftpd: 1					#让cobbler管理tftp服务

Insert picture description here

Insert picture description here

Insert picture description here

Insert picture description here

4. Start related services and close the firewall and selinux
systemctl start httpd.service		#开启http服务
systemctl start cobblerd.service		#开启cobbler服务
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
6.1 Modify tftp configuration file
vim /etc/xinetd.d/tftp
disable		= no

Insert picture description here

6.2 Start service
systemctl restart xinetd.service
systemctl start rsyncd.service    

Insert picture description here

7. Download the boot operating system file
cobbler get-loaders

Insert picture description here

8. Set the initial password of the Cobbler user
8.1 Use salt encryption to generate keys
openssl passwd -1 -salt 'abc123' 'abc123'	
		密码可以随便写  安装完系统后root用户的密码

Insert picture description here

8.2 Add the generated key to the Cobbler configuration file
vim /etc/cobbler/settings

Insert picture description here

Insert picture description here

9. Configure dhcp service
9.1 Modify the template file of Cobbler management dhcp service
vim /etc/cobbler/dhcp.template
subnet 192.168.249.0 netmask 255.255.255.0 {
   option routers             192.168.249.1;		#修改网关
   option domain-name-servers 192.168.249.2;		#修改DNS,如果网卡使用的是dhcp模式,可通过nslookup 127.0.0.1 | grep server 查询DNS地址
   option subnet-mask         255.255.255.0;
   range dynamic-bootp        192.168.249.100 192.168.249.200;   #修改地址池

Insert picture description here

9.2 Synchronize the configured template file to the configuration file of the DHCP service
cobbler sync

Insert picture description here

9.3 Restart the DHCP service
systemctl restart dhcpd.service

Insert picture description here

10. Import the ISO image file
10.1 Mount image file
mount /dev/sr0 /mnt

Insert picture description here

10.2 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  
#参数说明
#--path	表示镜像所挂载的目录
#--name	表示为安装源定义的名字
#--atch	表示指定安装源的系统位数
#默认导入存放路径为/var/www/cobbler/ks_mirror/CentOS-7-x86_64 

Insert picture description here

10.3 Check whether the kernel and initialization files are in the tftp-server shared directory
yum install -y tree 			#系统默认没有安装,需手动安装tree
tree /var/lib/tftpboot/images	#查看文件是否存在

Insert picture description here
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. Then use cobbler check to check the settings of Cobbler
cobbller check

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
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/shengmodizu/article/details/114133476