docker cobbler批量部署Linux/windows系统(二)——筑梦之路
2023-09-14 09:09:36 时间
上篇:https://blog.csdn.net/qq_34777982/article/details/116782745
前面使用docker部署好了cobbler服务端,本篇将接着上篇来实现批量部署安装centos/ubuntu系统。
这里补充下cobbler支持的操作系统说明:
1.cobbler由redhat公司开发,容器基础镜像使用centos兼容性更好;
2.检查cobbler支持的版本:
cobbler signature report --name=ubuntu
cobbler signature report --name=debian
cobbler signature report --name=centos
cobbler signature report --name=windows
没有列出的表示不支持,不建议使用cobbler批量部署。
3.Windows系统的自动安装需要配合相关的Autounattend.xml自动应答文件进行。
参考文章:https://www.cnblogs.com/pluse/p/8316914.html
https://blog.csdn.net/wfs1994/article/details/81041772
centos 7为例:
上传镜像iso文件到服务器/opt/iso/
mkdir -p /opt/iso
mount -t iso9660 -o loop,ro CentOS-7-x64-Minimal-1708.iso /mnt/centos7/
cobbler 导入:
cobbler import --path=/mnt/centos7/ --arch=x86_64 --name=centos7
导入镜像的同时,cobbler会自动生成该镜像的 profile 和 distro,可以通过 list 和 report 命令来查看细节,如下:
cobbler list
cobbler report
默认使用的应答文件/var/lib/cobbler/kickstarts/sample_end.ks
自定义ks应答文件:
#centos7.ks
auth --useshadow --enablemd5
bootloader --location=mbr
clearpart --all --initlabel
graphical
firewall --enabled
firstboot --disable
keyboard us
lang zh_CN
url --url=$tree
$yum_repo_stanza
$SNIPPET('network_config')
reboot
#Root password
rootpw --iscrypted $default_password_crypted
selinux --disabled
skipx
timezone Asia/Shanghai
install
zerombr
autopart
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
$SNIPPET('pre_anamon')
%end
%packages
$SNIPPET('func_install_if_enabled')
%end
%post --nochroot
$SNIPPET('log_ks_post_nochroot')
%end
%post
$SNIPPET('log_ks_post')
$yum_config_stanza
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
$SNIPPET('post_anamon')
$SNIPPET('kickstart_done')
%end
此处是一个简单的示例,具体语法参考:https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-syntax
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-syntax#sect-kickstart-commands
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/installation_guide/s1-kickstart2-options
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/
ubuntu 16.04 为例:
上传ubuntu 16.04 server镜像到/opt/iso
mount -t iso9660 -o loop,ro ubuntu-16.04.3-server-x64.iso /mnt/ubuntu16
cobbler 导入:
cobbler import --name=ubuntu16 --path=/mnt/ubuntu16/ --breed=ubuntu
#注意区别不同操作系统导入的命令
检查:
cobbler list
cobbler report
默认使用的自动应答文件/var/lib/cobbler/kickstarts/sample.seed
自定义ks:
#ubuntu16.ks
d-i debian-installer/locale string zh_CN
d-i console-setup/ask_detect boolean false
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/cst 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/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman-auto/choose_recipe select atomic
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password $default_password_crypted
d-i passwd/make-user boolean false
$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
根据实际情况修改。
官方示例:https://www.debian.org/releases/buster/example-preseed.txt
################################################################
ubuntu是基于debian的,因此这里批量部署debian系统也类似!!!!!!
相关文章
- 为什么国产操作系统要基于linux,解说国产Linux操作系统为什么都模仿Windows桌面…
- 「 【Docker】linux安装docker compose(小白安装) 」
- 的比较Linux与Windows:何者更胜一筹?(linux与window)
- 传输文件:从Linux到Windows(传文件到linux)
- windows比较Linux与Windows:谁占上风?(linuxvss)
- 在Windows 8上安装Linux:挑战性的引导(win8引导linux)
- Linux下查看和设置DNS地址(linux查看dns地址)
- Windows程序员学习Linux,C语言不可少(学linux用不用c语言)
- Linux与Windows的区别比较(linux和的区别)
- Linux的新分支:走向成熟的未来(linux的分支)
- Linux之家:探索开源世界的分支(linux的分支)
- Linux发展历程:从分支到大树(linux的分支)
- Linux的分支:实现多样性(linux的分支)
- Windows系统如何访问Linux共享文件夹(windows访问linux共享文件夹)
- 怎样的Linux目录结构:探究谜团(linux目录结构是)
- Linux下如何实现语音聊天?(linux语音聊天)
- 进入Linux程序设计世界的新手指引(《linux程序设计》)
- 和windows双系统安装:Linux与Windows并存(安装双系统linux)
- 简单改变,快速重命名Linux网卡(linux网卡重命名)
- Linux 密钥登录:简单安全的远程访问方式。(linux密钥登陆)
- 运行Windows程序?试试Linux下Wine(linux下wine)
- Linux轻松访问Windows共享文件夹,搞定文件共享(linux访问windows共享文件夹)
- Linux轻松移植文件至Windows(从linux下载文件到windows)
- 快速安装Linux上的Docker(linux安装docker)