Cobbler 安装与配置

Linux Ubuntu [[Cobbler]] Cobbler 安装与配置 Cobbler 介绍 Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。 Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。 Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。 Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack。 安装 以下操作,皆在 CentOS Linux release 7.7.1908 (Core) 实现。 检测基础环境 # 查看 selinux 和防火墙是否关闭 [root@Cobbler ~] getenforce Disabled [root@Cobbler ~] systemctl status firewalld.service ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1) 如果 getenfore 的结果不是 Disabled,那么根据 getenforce命令 去关闭 SELinux。 更新yum源 [root@Cobbler ~] curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo [root@Cobbler ~] curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo [root@Cobbler ~] yum clean all [root@Cobbler ~] yum makecache 安装 cobbler [root@Cobbler ~] yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd 启动服务 [root@Cobbler ~] systemctl start httpd.service [root@Cobbler ~] systemctl start cobblerd.service cobbler check [root@Cobbler ~] cobbler check 配置 cobbler 开机自启 $ chkconfig httpd on $ chkconfig cobblerd on $ chkconfig dhcpd on $ /etc/init.d/httpd restart $ /etc/init.d/cobblerd restart $ /etc/init.d/dhcpd restart 配置 cobbler [root@Cobbler ~] cobbler check The following are potential configuration items that you may want to fix: 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 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network. 3 : change 'disable' to 'no' in /etc/xinetd.d/tftp 4 : 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. 5 : enable and start rsyncd.service with systemctl 6 : debmirror package is not installed, it will be required to manage debian deployments and repositories 7 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one 8 : 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. 上面指出了八项问题,逐一解决。 ...

cobbler 服务在 docker 下运行

Linux [[Docker]] Cobbler cobbler 服务在 docker 下运行 主要参考 Cobbler 批量装机。 在宿主机上的 /mnt 内挂载镜像。 $ sudo mkdir /mnt/ubuntu18.04 $ sudo mkdir /mnt/centos $ sudo mount -t iso9660 -r -o ro,loop /tmp/ubuntu-18.04.3-server-amd64.iso /mnt/ubuntu18.04 $ sudo mount -t iso9660 -r -o ro,loop /tmp/CentOS-7-x86_64-DVD-1908.iso /mnt/centos 编辑自动应答脚本 ubuntu1804.seed: d-i debian-installer/locale string en_US.UTF-8 d-i console-setup/ask_detect boolean false 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 netcfg/get_nameservers string 192.168.31.1 d-i netcfg/get_ipaddress string d-i netcfg/get_netmask string 255.255.255.0 d-i netcfg/get_gateway string 192.168.31.1 d-i netcfg/confirm_static boolean true d-i netcfg/without_default_route boolean true d-i netcfg/enable boolean false 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-auto/disk string /dev/sda # d-i partman-auto/method string regular # d-i partman-auto/choose_recipe select fsm # d-i partman-lvm/device_remove_lvm boolean true # d-i partman-md/device_remove_md boolean true # d-i partman-auto/expert_recipe string \ # fsm :: \ # 1024 100% 1024 linux-swap method{ swap } \ # format{ } \ # . \ # 20480 20480 20480 ext4 method{ format } \ # mountpoint{ /tmp } \ # format{ } use_filesystem{ } filesystem{ ext4 } \ # options/relatime{ relatime } \ # . \ # 1 2048 1000000000 ext4 method{ format } \ # mountpoint{ /data } \ # format{ } use_filesystem{ } filesystem{ ext4 } \ # options/relatime{ relatime } \ # . # d-i partman-lvm/confirm_nooverwrite boolean true # d-i partman-lvm/confirm boolean true # d-i partman-partitioning/confirm_write_new_label boolean true # d-i partman/confirm_nooverwrite boolean true # d-i partman/confirm boolean true # d-i partman/choose_partition \ # select Finish partitioning and write changes to disk d-i passwd/root-login boolean true d-i passwd/root-password-crypted paddssword $1$root$6lvA6eQ6m1Qum8aZ4VWPV1 d-i passwd/make-user boolean true d-i passwd/user-fullname string firefly d-i passwd/username string firefly d-i passwd/user-password-crypted password $1$firefly$AbmnMjNadI/O7S/2vlojK. d-i passwd/user-uid string d-i passwd/user-default-groups string sudo adm cdrom dialout lpadmin plugdev sambashare d-i user-setup/allow-password-weak boolean false d-i user-setup/encrypt-home boolean false d-i apt-setup/services-select multiselect security d-i apt-setup/security_host string mirrors.aliyun.com d-i apt-setup/security_path string /ubuntu d-i debian-installer/allow_unauthenticated string false $SNIPPET('preseed_apt_repo_config') d-i pkgsel/include string ntp ssh wget vim d-i pkgsel/include string vim openssh-server d-i grub-installer/skip boolean false d-i lilo-installer/skip boolean false d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i finish-install/keep-consoles boolean false d-i finish-install/reboot_in_progress note d-i cdrom-detect/eject boolean true d-i debian-installer/exit/halt boolean false d-i debian-installer/exit/poweroff boolean false 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 /target/etc/apt/sources.list http://$http_server/sources.list ; \ wget -O /target/etc/locale.conf http://$http_server/locale.conf ; \ wget -O /target/etc/default/locale http://$http_server/locale ; \ cd /target ; \ chroot ./ apt-get update 启动虚拟机,并进入。 ...