当前位置:首页 > 系统 > CentOS7 使用cobbler批量安装

CentOS7 使用cobbler批量安装

系统3年前 (2020-02-14)

CentOS7 使用cobbler批量安装

cobbler是kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理,集成并接管了pxe、dhcp、Kickstart、tftp和http等服务,配置相对比较简单

CentOS7 使用cobbler批量安装

服务端192.168.10.11  DHCP范围192.168.10.100-192.168.10.110


安装组件

yum install cobbler cobbler-web dhcp httpd xinetd tftp-server syslinux pykickstart rsync -y


配置httpd

rm -rf /etc/httpd/conf.d/welcome.conf 
sed -i 's#\#ServerName www.example.com:80#ServerName 127.0.0.1:80#g' /etc/httpd/conf/httpd.conf
systemctl enable httpd
systemctl start httpd


配置cobbler

systemctl enable cobblerd
systemctl start cobblerd
cobbler check

#提示8个错误并逐一解决
#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.
#将server地址改为正确本机ip
sed -i 's/^server: 127.0.0.1/server: 192.168.10.11/' /etc/cobbler/settings

#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.
#指定tftp服务器地址
sed -i 's/^next_server: 127.0.0.1/next_server: 192.168.10.11/' /etc/cobbler/settings    

#3 : change 'disable' to 'no' in /etc/xinetd.d/tftp
#开启tftp
sed -i '/disable\>/s/\<yes\>/no/' /etc/xinetd.d/tftp     
sed -i '/manage_tftpd:/s/0/1/' /etc/cobbler/settings
systemctl enable tftp
systemctl restart tftp.service

#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.
#下载缺少的组件
cobbler get-loaders

#5 : enable and start rsyncd.service with systemctl
#开启rsyncd
sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings
systemctl enable rsyncd
systemctl start rsyncd 

#6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
#缺少debian组件 
yum install debmirror -y 
sed -i 's/@dists=\"sid\";/#@dists=\"sid\";/g' /etc/debmirror.conf
sed -i 's/@arches=\"i386\";/#@arches=\"i386\";/g' /etc/debmirror.conf

#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
#缺少创建的新系统初始密码
pass=`openssl passwd -1 -salt '12345678' '12345678' `
sed -i "101c default_password_crypted: \"$pass\"" /etc/cobbler/settings

#8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
#缺少fence设备相关和电源管理组件
yum install fence-agents -y

其他配置

#使用cobblerd接管dhcp
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings

#避免重复安装
sed -i 's/pxe_just_once: 0/pxe_just_once: 1/g' /etc/cobbler/settings

#修改dhcp配置模板 
sed -i '/^subnet/s/192.168.1.0/192.168.10.0/' /etc/cobbler/dhcp.template
sed -i '/routers/s/192.168.1.5/192.168.10.2/' /etc/cobbler/dhcp.template
sed -i '/domain-name-servers/s/192.168.1.1/192.168.10.2/' /etc/cobbler/dhcp.template
sed -i '/dynamic-bootp/s/192.168.1.100 192.168.1.254/192.168.10.100 192.168.10.110/' /etc/cobbler/dhcp.template

#再次检测
systemctl restart cobblerd.service
cobbler check

CentOS7 使用cobbler批量安装


同步配置

sed -n -e '/manage_tftpd:/p' -e '/manage_dhcp:/p' -e '/manage_rsync:/p' /etc/cobbler/settings
systemctl restart cobblerd.service
cobbler sync

CentOS7 使用cobbler批量安装


挂载镜像

mount -o loop /dev/cdrom /media
cobbler import --path=/media --name=CentOS-7.7.1908


指定ks

mv /root/anaconda-ks.cfg /var/lib/cobbler/kickstarts/centos7.ks
cobbler profile edit --name=CentOS-7.7.1908-x86_64 --distro=CentOS-7.7.1908-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7.ks

#附上centos7.ks
#version=RHEL7
# System authorization information
url --url=$tree    
#url --url http://192.168.10.11/cobbler/ks_mirror/CentOS-7.7.1908/
# Run the Setup Agent on first boot
firewall --disabled
selinux --disabled
reboot

ignoredisk --only-use=sda
 
# Keyboard
keyboard us
# System language
lang en_US.UTF-8
 
# Network information
network --onboot=yes --ipv6=no --bootproto=static --device=ens33 --gateway=192.168.10.2 --ip=192.168.10.15 --nameserver=8.8.8.8 --netmask=255.255.255.0

# Installation logging level
logging --level=debug

# Root password
rootpw --iscrypted $1$mgFXptMu$u3fP3Gbq5b49HqIPYMvS71
# System timezone
timezone Asia/Shanghai --isUtc
 
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
zerombr
clearpart --all --initlabel
#clearpart --none --initlabel
 
%packages
@^minimal
@compat-libraries
@core
@debugging
@development
@system-admin-tools
kexec-tools
tree
net-snmp
nmap
sysstat
lrzsz
dos2unix
telnet
iptraf
ncurses-devel
openssl-devel
zlib-devel
OpenIPMI-tools
screen
chrony
wget
net-tools
ntp
ntpdate
%end

CentOS7 使用cobbler批量安装


相关命令

cobbler list
cobbler report
cobbler profile report
cobbler distro list
cobbler distro report


网页管理

sed -i 's/authn_denyall/authn_configfile/g' /etc/cobbler/modules.conf
htdigest /etc/cobbler/users.digest "Cobbler" cobbler

#访问https://192.168.10.11/cobbler_web

CentOS7 使用cobbler批量安装

本站所有文章均可随意转载,转载时请保留原文链接及作者。

本文链接:https://www.vos.cn/os/402.html

相关文章

Oracle主备容灾方案

Oracle主备容灾方案

【实验需求】生产中心有一台Oracle服务器安装于Redhat Linux上,灾备中心有一台对应的容灾Oracle服务器,两台服务器的数据库空间来自各自所连接的T系列阵列LUN,阵列同Oracle服务...

利用LVM特性对EVE-NG硬盘分区扩容

利用LVM特性对EVE-NG硬盘分区扩容

下载的EVE-NG镜像中,存放模拟器镜像的分区太小了,上传几个cisco和juniper的模拟器就快满了,所以需要使用lvm特性对ubuntu server的硬盘分区进行扩容,首先先将eve-ng虚拟...

CentOS7 搭建LNMP

CentOS7 搭建LNMP

使用CentOS 1708,其实就是RHEL 7.4,使用YUM搭建LNMP环境(Linux、Nginx、MariaDB、PHP),全部使用新版组件,比如Nginx 1.12.2、MariaDB 10...

CentOS7安装PureFTP和vsFTP使用加密连接

CentOS7安装PureFTP和vsFTP使用加密连接

LNMP环境搭建好后,日后需要管理webroot路径下的文件,采用加密方式的FTP方式比较简单也安全安装PureFTPyum install pure-ftpd配置PureFTPv...

CentOS7 软RAID配置

CentOS7 软RAID配置

虚拟机添加4块新硬盘,形成5盘环境,做Linux软RAID磁盘阵列准备环境搭建添加硬件选择硬盘默认选择SCSI创建新虚拟磁盘容量默认20G,存储为单个文件加默认安装系统的,一共5个fdisk -l查看...

CentOS6 安装Oracle11gR2

CentOS6 安装Oracle11gR2

使用oracle-rdbms-server-11gR2-preinstall工具,自动安装oracle所需的RPM包,自动创建oracle用户和dba、oinstall组,自动配置/etc/sysct...