基于centos7部署cobbler批量安装系统

cobbler是一个可以实现批量安装系统的Linux应用程序。它有别于pxe+kickstart,cobbler可以实现同个服务器批量安装不同操作系统版本。

环境准备:
基于centos7部署cobbler批量安装系统

#ifconfig

基于centos7部署cobbler批量安装系统

#systemctl status firewalld

基于centos7部署cobbler批量安装系统
#getenforce
基于centos7部署cobbler批量安装系统

搭建本地源和扩展源

#vim /etc/yum.repos.d/local.repo

[local]
name=local
enabled=1
gpgcheck=0
baseurl=file:///mnt

[epel]
name=epel
enabled=1
gpgcheck=0
baseurl=https://mirrors.aliyun.com/epel/7/x86_64/


[centos]
name=centos base
enabled=1
gpgcheck=0
baseurl=http://mirrors.163.com/centos/7/os/x86_64/

#mount /dev/cdrom /mnt
#yum clean all

配置

#yum install cobbler dhcp tftp-server xinetd syslinux httpd -y

vim /etc/dhcp/dhcpd.conf

subnet 192.168.152.0 netmask 255.255.255.0 {
  range 192.168.152.10 192.168.152.20;
  default-lease-time 600;
  max-lease-time 7200;
  filename "pxelinux.0";
}

#systemctl restart dhcpd
#systemctl enable dhcpd

#vim /etc/xinetd.d/tftp
disable yes->no

基于centos7部署cobbler批量安装系统

#systemctl restart xinetd
#systemctl enable xinetd


#systemctl restart cobblerd
#cobbler check

基于centos7部署cobbler批量安装系统

解决报错:

#systemctl restart httpd
#vim /etc/cobbler/settings
把next_server和server修改成仅主机ip

基于centos7部署cobbler批量安装系统
基于centos7部署cobbler批量安装系统

#systemctl restart rsyncd
#systemctl enable rsyncd

#yum -y install pykickstart

#openssl passwd -1 -salt "123" "123"
加密数据第一个123是随机数,第二个123是密码

基于centos7部署cobbler批量安装系统

#vim /etc/cobbler/settings 

基于centos7部署cobbler批量安装系统

#systemctl restart cobblerd
#cobbler sync

基于centos7部署cobbler批量安装系统

#cobbler check
成功

基于centos7部署cobbler批量安装系统

#ls /mnt
查看光盘挂载

基于centos7部署cobbler批量安装系统

#cobbler import --path=/mnt --name="centos7.5"
#cobbler distro list

基于centos7部署cobbler批量安装系统

#cd
#cp anaconda-ks.cfg /var/lib/cobbler/kickstarts/ks.cfg
#vim /var/lib/cobbler/kickstarts/ks.cfg
修改cdrom

基于centos7部署cobbler批量安装系统
基于centos7部署cobbler批量安装系统

#cobbler profile add --distro=centos7.5-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks.cfg --name="centos7.5_pikachu"

cobbler profile add 
--distro=centos7.5-x86_64 
--kickstart=/var/lib/cobbler/kickstarts/ks.cfg 
--name="centos7.5_pikachu"

#cobbler profile list

基于centos7部署cobbler批量安装系统

#cobbler profile remove --name="centos7.5-x86_64"
#cobbler profile list

基于centos7部署cobbler批量安装系统

新创建一台虚拟机
基于centos7部署cobbler批量安装系统
基于centos7部署cobbler批量安装系统
基于centos7部署cobbler批量安装系统