文章目录
- 一.部署安装cobbler
- 1.编辑cobbler配置文件
- 2.持续安装所需文件
- 3.配置tftp
- 4.安装pykickstart
- 5.设置密码
- 6.cobbler管理DHCP
- 7.编辑启动应用服务脚本
- 二、镜像导入以及自动化文件必读须知
- 1.Centos7自动化操作系统安装
- 2.Ubuntu17.04自动化操作系统安装
- 3.Ubuntu18.04自动化操作系统安装
- 4.状态检查
一.部署安装cobbler
yum安装cobbler
[root@localhost ~]
[root@localhost ~]
[root@localhost ~]
[root@localhost ~]
[root@localhost ~]
[root@localhost ~]
[root@localhost ~]
1.编辑cobbler配置文件
[root@localhost ~]
....................
server: 192.168.4.15
next_server: 192.168.4.15
....................
virt_auto_boot: 1
....................
2.持续安装所需文件
[root@localhost ~]
3.配置tftp
[root@localhost ~]
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
}
[root@localhost ~]
[root@localhost ~]
启动xinetd
[root@localhost ~]
[root@localhost ~]
4.安装pykickstart
[root@localhost ~]
5.设置密码
设置密码、随机值123456 密码123456
[root@localhost ~]
$1$123456$wOSEtcyiP2N/IfIl15W6Z0
更改默认密码为:
[root@localhost ~]# vim /etc/cobbler/settings
default_password_crypted: "$1$123456$wOSEtcyiP2N/IfIl15W6Z0"
[root@localhost ~]# systemctl restart cobblerd
6.cobbler管理DHCP
[root@localhost ~]# vim /etc/cobbler/settings
manage_dhcp: 1
第一次修改模板文件。修改模板文件,生成dhcp配置文件。大致更改的地方有
[root@localhost ~]
subnet 192.168.4.0 netmask 255.255.255.0 {
option routers 192.168.4.2;
option domain-name-servers 192.168.4.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.4.100 192.168.4.254;
...................
重启cobblerd
[root@localhost ~]
[root@localhost ~]
7.编辑启动应用服务脚本
[root@localhost ~]
systemctl restart httpd
systemctl restart dhcpd
systemctl restart tftp
systemctl restart cobblerd
systemctl restart xinetd
systemctl restart rsyncd
二、镜像导入以及自动化文件必读须知
preseed文件参考网址如下:
- 模板位置:http://www.debian.org/releases/wheezy/example-preseed.txt
- 官方的安装手册:http://www.debian.org/releases/wheezy/i386/
live、desktop的ubuntu18.04镜像不能使用cobller做为iso导入。请使用server-amd64。附带下载连接地址如下:
- http://cdimage.ubuntu.com/releases/
cobbler+ubuntu不能使用kickstart的cfg文件的格式,做为自动化菜单安装的实现文件。ubuntu操作系统使用ks.cfg文件会被强制转为preseed文件内容实现。所以,附带以下ubuntu.seed文件内容跟,参考。
1.Centos7自动化操作系统安装
CentOS7.cfg文件内容
install
keyboard 'us'
rootpw --iscrypted $1$cGHsDwpI$T9DXXY71ndF0Gp9F9mT4f/
lang en_US
auth --useshadow --passalgo=sha512
text
selinux --disabled
skipx
firewall --disabled
network --bootproto=dhcp --device=ens33
reboot
timezone Asia/Shanghai --isUtc
url --url=$tree
bootloader --location=mbr
zerombr
clearpart --all --initlabel
part /boot --fstype="xfs" --size=1024
part swap --fstype="swap" --size=4096
part / --fstype="xfs" --grow --size=1
%packages
@^minimal
@core
@development
kexec-tools
wget
vim
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%post
systemctl disable postfix.service
%end
[root@localhost ~]
[root@localhost ~]
[root@localhost ~]
distros:
Centos-7-x86_64
profiles:
Centos-7-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:
2.Ubuntu17.04自动化操作系统安装
ubuntu17.04.seed文件内容
[root@localhost ~]
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
d-i keyboard-configuration/toggle select No toggling
d-i keyboard-configuration/layoutcode string us
d-i keyboard-configuration/variantcode string
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string $myhostname
d-i time/zone string Asia/Shanghai
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string ntp.ubuntu.com
d-i mirror/country string manual
d-i mirror/http/hostname string $http_server
d-i mirror/http/directory string $install_source_directory
d-i mirror/http/proxy string
d-i live-installer/net-image string http://$http_server/cobbler/links/$distro_name/install/filesystem.squashfs
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-auto/purge_lvm_from_device boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman/alignment select cylinder
d-i partman/confirm boolean true
d-i partman-basicfilesystems/no_swap boolean false
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm_nooverwrite boolean true
d-i grub-installer/only_debian boolean true
d-i partman-auto/method string regular
d-i partman-auto/expert_recipe string \
boot-root :: \
1024 1 1024 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
1 3 -1 ext4 \
$primary{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
. \
4096 2 4096 linux-swap \
$primary{ } \
method{ swap } format{ } \
.
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password $default_password_crypted
d-i passwd/make-user boolean true
d-i passwd/user-fullname string ubuntu
d-i passwd/username string ubuntu
d-i passwd/user-password-crypted password $default_password_crypted
$SNIPPET('preseed_apt_repo_config')
tasksel tasksel/first multiselect standard
d-i pkgsel/include string ntp ssh wget
d-i grub-installer/grub2_instead_of_grub_legacy boolean true
d-i grub-installer/bootdev string default
d-i debian-installer/add-kernel-opts string $kernel_options_post
d-i finish-install/reboot_in_progress note
d-i preseed/early_command string wget -O- \
http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_early_default | \
/bin/sh -s
d-i preseed/late_command string wget -O- \
http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_late_default | \
chroot /target /bin/sh -s
[root@localhost ~]
distros:
Ubuntu-17-x86_64
profiles:
Ubuntu-17-x86_64
systems:
repos:
Ubuntu-17-x86_64
images:
mgmtclasses:
packages:
files:
[root@localhost ~]
[root@localhost ~]
3.Ubuntu18.04自动化操作系统安装
ubuntu18.04 seed文件内容
因为镜像文件中不存在ntp,取消了默认安装程序中安装ntp程序,不取消ntp安装,自动化安装会卡住窗口无法进行下去
[root@localhost kickstarts]
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
d-i keyboard-configuration/toggle select No toggling
d-i keyboard-configuration/layoutcode string us
d-i keyboard-configuration/variantcode string
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string $myhostname
d-i time/zone string Asia/Shanghai
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean false
d-i mirror/country string manual
d-i mirror/http/hostname string $http_server
d-i mirror/http/directory string $install_source_directory
d-i mirror/http/proxy string
d-i live-installer/net-image string http://$http_server/cobbler/links/$distro_name/install/filesystem.squashfs
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-auto/purge_lvm_from_device boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman/alignment select cylinder
d-i partman/confirm boolean true
d-i partman-basicfilesystems/no_swap boolean false
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm_nooverwrite boolean true
d-i grub-installer/only_debian boolean true
d-i partman-auto/method string regular
d-i partman-auto/expert_recipe string \
boot-root :: \
1024 1 1024 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
1 3 -1 ext4 \
$primary{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
. \
4096 2 4096 linux-swap \
$primary{ } \
method{ swap } format{ } \
.
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password $default_password_crypted
d-i passwd/make-user boolean true
d-i passwd/user-fullname string ubuntu
d-i passwd/username string ubuntu
d-i passwd/user-password-crypted password $default_password_crypted
$SNIPPET('preseed_apt_repo_config')
tasksel tasksel/first multiselect standard
d-i pkgsel/include string ssh wget
d-i grub-installer/grub2_instead_of_grub_legacy boolean true
d-i grub-installer/bootdev string default
d-i debian-installer/add-kernel-opts string $kernel_options_post
d-i finish-install/reboot_in_progress note
d-i preseed/early_command string wget -O- \
http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_early_default | \
/bin/sh -s
d-i preseed/late_command string wget -O- \
http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_late_default | \
chroot /target /bin/sh -s
上传iso镜像,挂载/mnt下,导入文件内容到cobbler中
[root@localhost ~]
[root@localhost ~]
查看cobbler的相关信息,发现ubuntu18.04导入是两个Ubuntu-18.04.3-x86_64、Ubuntu-18.04.3-hwe-x86_64
[root@localhost ~]
distros:
Ubuntu-18.04.3-hwe-x86_64
Ubuntu-18.04.3-x86_64
profiles:
Ubuntu-18.04.3-hwe-x86_64
Ubuntu-18.04.3-x86_64
systems:
repos:
Ubuntu-18.04.3-hwe-x86_64
Ubuntu-18.04.3-x86_64
images:
mgmtclasses:
packages:
files:
4.状态检查
查看镜像相关的seed或cfg自动化引导安装文件
[root@localhost kickstarts]# cobbler profile report
Name : Ubuntu-17-x86_64
..........
Kickstart : /var/lib/cobbler/kickstarts/ubuntu.seed
..........
Name : Ubuntu-18.04.3-x86_64
..........
Kickstart : /var/lib/cobbler/kickstarts/ubuntu18.seed
..........
Name : Centos-7-x86_64
..........
Kickstart : /var/lib/cobbler/kickstarts/CentOS7.cfg
..........
Name : Ubuntu-18.04.3-hwe-x86_64
..........
Kickstart : /var/lib/cobbler/kickstarts/ubuntu18.seed
..........
以下有此两个信息检查信息提示,不必在意
The following are potential configuration items that you may want to fix:
1 : One or more repos need to be processed by cobbler reposync for the first time before kickstarting against them: Ubuntu-18.04.3-x86_64, Ubuntu-18.04.3-hwe-x86_64
2 : 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.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)