利用cobbler 实现系统自动化安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了利用cobbler 实现系统自动化安装相关的知识,希望对你有一定的参考价值。

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 实现系统自动化安装的主要内容,如果未能解决你的问题,请参考以下文章

利用cobbler实现自动化安装

基于cobbler实现自动化安装系统

cobbler+pxe实现系统自动化安装

基于 cobbler 实现自动安装 linux 系统

CentOS6.9上安装cobbler2.6实现自动化安装Linux系统

自动化运维——CentOS7下利用Cobbler批量部署CentOS