1.安装cobbler
yum update -y
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
yum install cobbler cobbler-web dhcp debmirror pykickstart fence-agents -y
2.启用cobbler服务并设置开机启动
systemctl start cobblerd httpd rsyncd tftp
systemctl enable cobblerd httpd rsyncd tftp
3.访问cobbler,初始账号密码都是cobbler
https://IP/cobbler_web
4.设置安装系统的root密码
openssl passwd -1 -salt 'root' 'bzhantest'
$1$root$.gzVksjqp.P3KiqnIaJG6/
5.设置cobbler配置文件
vim /etc/cobbler/settings
default_password_crypted: "$1$root$.gzVksjqp.P3KiqnIaJG6/"
server: 192.168.40.131
next_server: 192.168.40.131
manage_dhcp: 1
6.配置debmirror.conf
sed -i 's/@dists="sid";/#@dists="sid";/g' /etc/debmirror.conf
sed -i 's/@arches="i386";/#@arches="i386";/g' /etc/debmirror.conf
7.配置tftp
vim /etc/xinetd.d/tftp
disable = no
8.下载引导文件
cobbler get-loaders
# cobbler get-loaders (成功如下)
task started: 2020-05-06_164813_get_loaders
task started (id=Download Bootloader Content, time=Wed May 6 16:48:13 2020)
path /var/lib/cobbler/loaders/README already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/COPYING.elilo already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/COPYING.yaboot already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/COPYING.syslinux already exists, not overwriting existing content, use --force if you wish to update
downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***
会报错
//原因是因为python的字符集编码不一致造成的
//解决办法如下
[root@manager-61 /]# cat >> /usr/lib/python2.7/site-packages/sitecustomize.py <<EOF
# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
EOF
//然后reboot
9.编辑dhcp文件(根据实际情况改)
vim /etc/cobbler/dhcp.template
subnet 192.168.49.0 netmask 255.255.255.0 {
option routers 192.168.49.2;
option domain-name-servers 223.5.5.5;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.49.100 192.168.49.254;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
10.重启cobbler并同步
systemctl restart cobblerd
cobbler sync
11.检查 (根据提示来)
# cobbler check
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 : 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.
Restart cobblerd and then run 'cobbler sync' to apply changes.
# cobbler check(成功如下)
No configuration problems found. All systems go.
12.cobbler验证
# cobbler validateks
task started: 2020-05-06_164644_validateks
task started (id=Kickstart Validation, time=Wed May 6 16:46:44 2020)
*** all kickstarts seem to be ok ***
*** TASK COMPLETE ***
13、下载centos7镜像,挂在到/mnt/iso下,并导入到cobbler
mkdir /mnt/iso
mount CentOS-7-x86_64-Everything-1810.iso /mnt/iso
cobbler import --arch=x86_64 --path=/mnt/iso --name=CentOS7
14.回到cobbler网页,点击kickstart templates,创建ks模板。
![](https://i-blog.csdnimg.cn/blog_migrate/4c9d1ecf319a8322b3678d9bdc9ae941.png)
15.centos7安装模板
# CentOS 7 minimal(放到名称那一栏)
text
install
bootloader --location=mbr
zerombr
auth --useshadow --passalgo=sha512
rootpw --iscrypted $default_password_crypted
firewall --disable
selinux --disabled
firstboot --disable
keyboard us
lang en_US
timezone Asia/Shanghai
url --url=$tree
$SNIPPET('network_config')
clearpart --all --initlabel
part /boot --fstype="xfs" --size=512
part swap --fstype="swap" --size=1024
part / --fstype="xfs" --grow --size=1
reboot
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
$SNIPPET('pre_anamon')
%end
%packages
@^minimal
@core
kexec-tools
%end
![](https://i-blog.csdnimg.cn/blog_migrate/8b2fe9152f8dbcbae2940e85a607e6fa.png)
![](https://i-blog.csdnimg.cn/blog_migrate/352a44537c8418b68bd9daca11a7f6bc.png)
![](https://i-blog.csdnimg.cn/blog_migrate/aa069ee32a7ca9a4dd6c56998e350af1.png)
17.配置一台机器从网卡启动看效果(注意内存给大一点,不然不成功)
![](https://i-blog.csdnimg.cn/blog_migrate/6754fb972c0fd1e05d7774ce1bfd97f3.png)
https://www.cnblogs.com/ops-sylar/p/8243929.html
http://www.178linux.com/15099 有提组件
https://www.cnblogs.com/edenlong/p/10146446.html foreman容器化部署图形操作,有待实验
https://www.cnblogs.com/zhangxingeng/p/9702625.html centos7+cobbler+kickstart
https://www.cnblogs.com/zhangxingeng/p/10268171.html#auto_id_15 Centos7+puppet+foreman,图形实现部署OS