1.Cobbler服务器的部署

Server端

第一步:启动Cobbler服务 第二步:进行Cobbler错误检查,执行cobbler check命令 第三步:进行配置同步,执行cobbler sync命令 第四步:复制相关启动文件到TFTP目录中 第五步:启动DHCP服务,提供地址分配 第六步:DHCP服务分配IP地址 第七步:TFTP传输启动文件 第八步:Server端接收安装信息 第九步:Server端发送ISO镜像和Kickstart文件

Client端

第一步:客户端以PXE模式启动 第二步:客户端获取IP地址 第三步:通过TFTP服务器获取启动文件 第四步:进入Cobbler安装选择界面 第五步:客户端确定加载信息 第六步:根据配置信息准备安装系统 第七步:加载Kickstart文件 第八步:传输系统安装的其它文件 第九步:进行系统安装

 

安装Cobbler

环境准备

更新Yum源
 
 
 
 
 
 
 
 
# 先安装epel源
$ yum -y install epel-release
# 更新yum源
$ yum -y update
 
关闭防火墙和SELinux
 
 
 
 
 
 
 
 
# 通过setforce设置SELinux的状态,如果是Permissive不行,必须为disabled
$ setenforce 0
$ sed -ri '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config
$ systemctl stop firewalld
$ systemctl disable firewalld
$ iptables -F
 
固定IP

因为如果是动态DHCP获取IP的话,之后IP可能会变化

 
 
 
 
 
 
 
 
$ vim /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE="Ethernet"
BOOTPROTO="none"
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
IPADDR=192.168.0.196
PREFIX=24
GATEWAY=192.168.0.1
DNS1=223.5.5.5
DNS2=223.6.6.6
 
安装DHCP
 
 
 
 
 
 
 
 
$ yum -y install dhcp xinetd tftp-server httpd
 
开启HTTP
 
 
 
 
 
 
 
 
$ systemctl start httpd dhcpd
$ systemctl enable httpd dhcpd
 

安装Cobbler

 
 
 
 
 
 
 
 
$ yum -y install cobbler
$ systemctl start cobblerd
$ systemctl enable cobblerd
$ cobbler check
 

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.1 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.1 3 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment: https://github.com/cobbler/cobbler/wiki/Selinux[^2] 4 : change 'disable' to 'no' in /etc/xinetd.d/tftp2 5 : 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.3 6 : enable and start rsyncd.service with systemctl4 7 : debmirror package is not installed, it will be required to manage debian deployments and repositories5 8 : ksvalidator was not found, install pykickstart6 9 : 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 one7 10 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them[^9]

 
 
 
 
 
 
 
 
# 上述错误修改完毕后,重启cobbler
$ systemctl restart cobblerd
$ cobbler check
 

The following are potential configuration items that you may want to fix:

1 : comment out 'dists' on /etc/debmirror.conf for proper debian support8 2 : comment out 'arches' on /etc/debmirror.conf for proper debian support8

Restart cobblerd and then run 'cobbler sync' to apply changes.

 
 
 
 
 
 
 
 
# 修复完上述问题
$ cobbler check
 

check

出现上述情况说明,Server端已经安装成功,接下来修改配置

 

Cobbler配置
修改cobbler配置
 
 
 
x
 
 
 
 
$ vim /etc/cobbler/settings
# 启动DHCP管理
manage_dhcp: 1
 
修改DHCP配置
 
 
 
 
 
 
 
 
$ vim /etc/cobbler/dhcp.template
# 需要保证下面配置的IP和Cobbler Server机器在一个网段上
subnet 192.168.0.0 netmask 255.255.255.0 {
     option routers             192.168.0.196;                    # 修改为cobbler server端所在机器IP
     option domain-name-servers 192.168.0.1;  # 修改为cobbler server端所在机器IP
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.0.100 192.168.0.254; # dhcp所分配的网段
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
 

重新同步一次

 
 
 
x
 
 
 
 
$ cobbler sync
$ systemctl restart cobblerd
$ systemctl restart dhcpd
 

 

 

问题1:

21

没有开启HTTP服务,开启HTTP服务即可


1
$ vim /etc/cobbler/settings
#修改为Cobbler server端所在机器IP
server: 192.168.0.95
next_server: 192.168.0.95
2
$ vim /etc/xinetd.d/tftp
disable = no
3 下载网络引导文件进行修复
$ cobbler get-loaders
4
$ systemctl start rsyncd
$ systemctl enable rsyncd
5
$ yum -y install debmirror
6
$ yum -y install pykickstart
7
# 生成密码
$ openssl passwd -1 -salt "test" "redhat"
# 修改密码
$ vim /etc/cobbler/settings
default_password_crypted: "$1$mF86/UHC$WvcIcX2t6crBz2onWxyac."
8
$ vim /etc/debmirror.conf
# 将下面两行注释掉
# @dists="sid";
# @arches="i386";

 

 
posted @ 2020-03-04 13:56  情浅凉心  阅读(709)  评论(0编辑  收藏  举报