cobbler安装

cobbler服务器部署

1.1 前置工作

systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i -r 's/^(SELINUX=).*$/\1disabled/g' /etc/selinux/config

1.1.2 替换yum

mv /etc/yum.repos.d/CentOS-Base.repo{,.bak}
  curl -o /etc/yum.repos.d/CentOS-Base.repo \
  'http://mirrors.aliyun.com/repo/Centos-7.repo'
  yum clean all && yum makecache && \
  yum update -y && yum install -y net-tools nc \
  vim gcc-c++ gcc make cmake wget autoconf git \
  bind-utils telnet epel-release unzip screen tcpdump && \
  systemctl reboot

1.2 yum安装

yum install -y cobbler cobbler-web dhcp tftp-server pykickstart httpd debmirror fence-agents-all xinetd

1.3 启动服务

systemctl enable httpd cobblerd
systemctl start httpd cobblerd

1.4 检测异常

1.4.1 解决Cobbler服务异常: 1,2,8(修改系统密码/tftp服务器地址/服务器地址)

cp /etc/cobbler/settings{,.bak}
# 我当前的内网IP是: 10.1.1.3,注意修改以下内容
sed -i 's/server: 127.0.0.1/server: 10.1.1.3/g' /etc/cobbler/settings
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings
sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
# 以下内容中:'yxt2019'为新装系统root用户的密码,可自行修改;'cobble'为混淆加密标识符,自定 义前需要针对配置文件做相关修改
tmp_pw="$(openssl passwd -1 -salt 'cobble' 'yxt2019' | sed -r 's/\//\\\//g' | sed -r
   's/\$/\\\$/g')" && sed -i -r "s/^(default_password_crypted: ).*$/\1\"${tmp_pw}\"/g"
   /etc/cobbler/settings

1.4.2 解决Cobbler服务异常: 3,4,5(tftp自启动/加载boot-loader/rsyncd)

  cp /etc/xinetd.d/tftp{,.bak}
  sed -i -r 's/^(.*disable.*=.*)yes/\1no/g' /etc/xinetd.d/tftp
  systemctl enable xinetd
  systemctl start xinetd
  cobbler get-loaders
  systemctl enable rsyncd
  systemctl start rsyncd

1.4.3 解决cobbler服务异常6、7

 cp /etc/debmirror.conf{,.bak}
 sed -i 's|@dists=.*|#@dists=|' /etc/debmirror.conf
 sed -i 's|@arches=.*|#@arches=|' /etc/debmirror.conf

1.4.4 解决dhcp服务的修改

cp /etc/cobbler/dhcp.template{,.bak}
vim /etc/cobbler/dhcp.template

1.4.5 所有异常都解决完毕之后重启服务并同步配置

  systemctl restart cobblerd
  cobbler sync
注:cobbler库同步时可能会出问题,原因为没有找到库,我将库来整理到以下链接中
https://github.com/lifei188022/cobblerloader


然后放到 /var/lib/cobbler/loaders/ 目录

1.5 再次检测cobbler服务状态

cobbler check
###### ###### ###### 大概会显示如下内容 ###### ###### ###### 
No configuration problems found. All systems go.
###### ###### ###### 上边的意思是有没异常 ###### ###### ######

2.0 登陆

https://ip/cobbler_web
帐号 cobbler 密码 cobbler

补充

定制kickstart 文件

cat /var/lib/cobbler/kickstarts/xinan
# This kickstart file should only be used with EL > 5 and/or Fedora > 7.
# For older versions please use the sample.ks kickstart file.

#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth  --useshadow  --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --enabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Use network installation
url --url=$tree
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# Network information
$SNIPPET('network_config')
# Reboot after installation
#reboot

#Root password
rootpw --iscrypted $default_password_crypted
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone  America/New_York
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
#autopart
#firstDisk=`head -1 /tmp/disks|awk -F'/' '{print $3}'`
part biosboot --fstype=biosboot --size=1
part /boot --fstype=ext4 --asprimary --size=1024 --ondisk=/dev/sda
part swap --fstype=swap --asprimary --size=33024 --ondisk=/dev/sda
part / --fstype=ext4 --grow --asprimary  --size=2000 --ondisk=/dev/sda
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end

%packages
$SNIPPET('func_install_if_enabled')
%end

%post --nochroot
$SNIPPET('log_ks_post_nochroot')
%end

%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
rm -rf /etc/yum.repos.d/cobbler-config.repo
%end
posted @ 2022-01-14 13:21  lifei888  阅读(102)  评论(0编辑  收藏  举报