利用cobbler 實現系統自動化安裝
阿新 • • 發佈:2019-04-20
name oot c4c check edi oar shm available med 1 安裝包和配置服務
root:~# yum install cobbler dhcp -y
root:~# systemctl enable tftp dhcpd httpd cobblerd
root:~# systemctl start tftp httpd cobblerd
2 修改cobbler 配置文件
vim /etc/cobbler/settings
server: cobblerIP 384
next_server: cobblerIP 272
default_password_crypted: "$1$VBqc7U0W$F2qhI5oZwR8chJBU.mAly1" 101
manage_dhcp: 1 242 #可自動配置dhcp
root:~# cobbler get-loaders task started: 2019-04-19_074328_get_loaders task started (id=Download Bootloader Content, time=Fri Apr 19 07:43:28 2019) downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README downloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux 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 *** root:~# cobbler sync task started: 2019-04-19_074450_sync ********* !!! TASK FAILED !!!
3 配置dhcp服務
root:~# vim /etc/cobbler/dhcp.template subnet 192.168.64.0 netmask 255.255.255.0 { option routers 192.168.64.254; option domain-name-servers 1.1.1.1; option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.64.100 192.168.64.254 root:~# cobbler sync task started: 2019-04-19_075613_sync task started (id=Sync, time=Fri Apr 19 07:56:13 2019) running pre-sync triggers .................................. running shell triggers from /var/lib/cobbler/triggers/change/* *** TASK COMPLETE ***
4導入安裝源文件
將光盤掛載好
root:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/centos-root 52403200 2066756 50336444 4% /
devtmpfs 919432 0 919432 0% /dev
tmpfs 931612 0 931612 0% /dev/shm
tmpfs 931612 9744 921868 2% /run
tmpfs 931612 0 931612 0% /sys/fs/cgroup
/dev/sda1 1038336 149004 889332 15% /boot
/dev/mapper/centos-home 154057220 33100 154024120 1% /home
tmpfs 186324 0 186324 0% /run/user/0
/dev/sr0 10491772 10491772 0 100% /mnt/7
/dev/sr1 3897932 3897932 0 100% /mnt/6
root:~# cobbler import --path=/mnt/6 --name=Centos-6.10 --arch=x86_64
task started: 2019-04-19_080352_import
task started (id=Media import, time=Fri Apr 19 08:03:52 2019)
Found a candidate signature: breed=redhat, version=rhel6
Found a matching signature: breed=redhat, version=rhel6
Adding distros from path /var/www/cobbler/ks_mirror/Centos-6.10-x86_64:
creating new distro: Centos-6.10-x86_64
trying symlink: /var/www/cobbler/ks_mirror/Centos-6.10-x86_64 -> /var/www/cobbler/links/Centos-6.10-x86_64
creating new profile: Centos-6.10-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/Centos-6.10-x86_64 for Centos-6.10-x86_64
processing repo at : /var/www/cobbler/ks_mirror/Centos-6.10-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/Centos-6.10-x86_64
looking for /var/www/cobbler/ks_mirror/Centos-6.10-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/Centos-6.10-x86_64/repodata
*** TASK COMPLETE ***
查看現有安裝選項
root:~# cobbler profile list
Centos-6.10-x86_64
現在已經可以自動化安裝了,不過cobbler默認配置文件為最小化安裝,想要自定義的花要修改配置文件
Centos 7.0下使用system-config-kickstart
修改CentOS-Base.repo
[base] 修改 ---------->[development]
name=CentOS-$releasever - Base
root:~# yum install -y system-config-kickstart.noarch
root:~ # env LANG=zh_CN.UTF-8 system-config-kickstart #生成自定義配置文件
將所有選項選完即可左上角保存
利用cobbler 實現系統自動化安裝