先放出官方网址: https://cobbler.github.io/,官方介绍如下:
Cobbler is a Linux installation server that allows for rapid setup of network installation environments. It glues together and automates many associated Linux tasks so you do not have to hop between many various commands and applications when deploying new systems, and, in some cases, changing existing ones. Cobbler can help with provisioning, managing DNS and DHCP, package updates, power management, configuration management orchestration, and much more.
简单说就是以前的 kickstart的升级版,可以通过web(https)的方式来方便查看,更改应答文件.支持多系统(centos,ubuntu,suse)
下面介绍如何在centos7.6 环境下安装Cobbler
1,安装epel-release 源
yum install epel-release
2.安装其他依赖包
yum install cobbler-web dhcp tftp-server httpd rsync xinetd pykickstart -y
3.关闭 selinux,放行69/udp,80/tcp,443/tcp端口
setenforce 0 #临时关闭 selinux
firewall-cmd --zone=public --permanent --add-port=69/udp #放行tftp69端口
firewall-cmd --zone=public --permanent --add-port=80/tcp #放行80(http)端口
firewall-cmd --zone=public --permanent --add-port=443/tcp #放行443(https)端口
firewall-cmd --reload #重载防火墙
4.增加一个web用户名"admin",密码设为"123456".
htdigest /etc/cobbler/users.digest Cobbler admin #Cobbler 首字母"C"需要大写
5.修改配置文件
# vim /etc/cobbler/settings
server: 192.168.1.9 #默认是本机,需要用服务器ip代替
next_server: 192.168.1.9 #默认是本机,需要用服务器ip代替
manage_dhcp: 1 #启用管理dhcp功能
pxe_just_once: 1 #默认同一台机器只安装一次
# 设置新装系统的默认root密码123456。下面的命令来源于提示。
# openssl passwd -1 -salt 'test' '123456'
# $1$forfun$q8gjm/wakmbRmWf4Ci5QU1 #生成的加密密码
# vim /etc/cobbler/settings
default_password_crypted: "$1$forfun$q8gjm/wakmbRmWf4Ci5QU1"
6.启动cobbler,httpd服务
systemctl start cobblerd.service #开启cobbler服务
systemctl enable cobblerd.service #设为开机启动
systemctl start httpd.service #开启httpd服务
systemctl enable httpd.service #设为开机启动
7.下载引导文件
cobbler get-loaders #下载引导文件
8.change 'disable' to 'no' in /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
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no #修改此处
per_source = 11
cps = 100 2
flags = IPv4
}
9.配置dhcp,只显示需要修改的部分.
vim /etc/cobbler/dhcp.template
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.9; #服务器ip
option domain-name-servers 192.168.1.9; #服务器ip
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.1.100 192.168.1.254; #dhcp起始至结束范围
}
10.同步设置
cobbler sync
11.启动相关服务
systemctl start dhcpd.service
systemctl enable dhcpd.service
systemctl start xinetd.service
systemctl enable xinetd.service
systemctl start rsyncd.service
systemctl enable rsyncd.service
12.挂载镜像(以Centos7.6举例)
mount -r Downloads/CentOS-7-x86_64-DVD-1810.iso /mnt/
13.导入镜像
cobbler import --path=/mnt/ --name=CentOS-7.6-x86_64 --arch=x86_64
# --path 镜像挂载的路径
# --name 为安装源定义一个名字
# --arch 指定安装源的架构
cobbler list #查看导入结果
14.查看对应的kickstart文件路径
cobbler distro report --name=CentOS-7.6-x86_64
15.以上导入镜像的操作也通过cobbler-web 来完成
在浏览器中输入 https://192.168.1.9/cobbler_web #其中192.168.1.9为服务器的ip地址
点击左侧的Import DVD,Perfix(镜像名词),Arch(架构),Breed(分支),Path(镜像挂载路径),点击Run后即会执行导入镜像的操作(需要等待一定时间),可以通过左侧的Events查看当前的进度.
还可以点击左侧的Profiles查看存在的配置,以及通过点击View Kickstart查看对应的kickstart文件
点击Edit执行编辑操作
16.其他主机选择从网卡启动即可看到网络引导的选项了
有一点需要注意,默认的kickstart文件(sample_end.ks),会清空分区表,然后重新建分区,所以主机上有数据的同学要手动分区才可以保留以前的数据.对kickstart的语法感兴趣的同学自己百度吧.怕麻烦的也可以通过安装 system-config-kickstart 自己配置kickstart文件
yum install system-config-kickstart
使用命令: system-config-kickstart 启动kickstart配置工具,如下图
其实就是模拟安装操作系统的过程,然后依据自己的需要来完成操作。配置完成后,点击菜单栏中的 File-Preview 来预览生成的kickstart文件。如果确定无误就可以在cobbler_web添加刚才的配置文件如下图,依次点击左侧的 Kickstart Templates , Create New Kickstart File.然后将刚才的文件内容复制进去即可。
完结散花。