cobbler搭建

@Date    : 2019-07-12
@Author  : Spinach | GHB
@Link    : http://blog.csdn.net/bocai8058

OS: centos7
ip: 172.16.247.206
MAC addr: 00:50:56:3E:6F:8B
hostname: hadoop06

以下操作请按从上到下依次顺序执行,如出现报错问题请自行搜索或询问Spinach。

准备工作(centos7)

黄色背景字体为开启服务或重启服务、查看状态;黑色字体为设置操作

操作描述 命令
更新源 yum install epel-release
安装组件 yum install cobbler cobbler-web tftp-server dhcp httpd xinetd pykickstart fence-agents(确保每个都已安装)[再执行一遍可查看是否已安装]
启动并使能服务 systemctl start httpd cobblerd && systemctl enable httpd cobblerd
查看服务状态 systemctl status httpd cobblerd
关闭防火墙 systemctl stop firewalld && systemctl disable firewalld &&systemctl status firewalld
关闭SELinux 1. getenforce获取当前状态 2. vi /etc/selinux/config ——>设置SELINUX=disabled 3. reboot

配置dhcp

命令 操作
vi /etc/dhcp/dhcpd.conf 添加如下内容至文件结尾
# A slightly different configuration for an internal subnet.
subnet 172.16.247.0 netmask 255.255.255.0 {
  range 172.16.247.245 172.16.247.250;
  option domain-name-servers ns1.internal.example.org;
  option domain-name "172.16.247.206";
  option routers 172.16.247.1;
  option broadcast-address 172.16.247.255;
  default-lease-time 600;
  max-lease-time 7200;
}

#for cobbler setup
host cobbler {
	option host-name "hadoop06"; 
	ddns-hostname "hadoop06"; 
	hardware ethernet 00:50:56:3E:6F:8B; #mac地址
		fixed-address 172.16.247.206; 
		allow booting;
		allow bootp;
		class "PXE" {
				match if substring (option vendor-class-idrntifier,0,9) = "PXEClient";
				next-server 172.16.247.206;
				filename "pxelinux.0";
		}
}

配置cobbler

命令 操作 内容
vi /etc/cobbler/settings 修改 next_server:172.16.247.206 server:172.16.247.206
sed -ri ‘/disable/c\disable=no’ /etc/xinetd.d/tftp 执行命令即可
sed -ri ‘/disable/c\disable=no’ /etc/xinetd.d/rsync 执行命令即可(在执行之前先查看是否有此文件,若没有,则此命令跳过不执行
systemctl enable xinetd && systemctl restart xinetd && systemctl status xinetd 启动tftp-server,并查看状态
systemctl restart httpd cobblerd && systemctl status httpd cobblerd 重启httpd、cobbler服务,并查看状态
cobbler check 查看cobbler启动需求
systemctl start rsyncd && systemctl enable rsyncd && systemctl status rsyncd 启动rsync,并查看状态
cobbler check 查看cobbler启动需求 应该相比上一次执行cobbler check后少一需求
openssl passwd -1 -salt ‘spinach’ ‘spinach’ 创建新密码,用于cobbler自动化安装系统后root的默认密码 执行完后生成,如: 1 1 spinach$PPd1y7cKopgHHEHoFRPIW.
vi /etc/cobbler/settings 修改(此处填写上一命令执行后生成的密码,保持一致) default_password_crypted:“ 1 1 spinach$PPd1y7cKopgHHEHoFRPIW.”
vi /etc/cobbler/dhcp.template 修改 如下图1
cobbler check 查看cobbler启动需求 应该相比上一次执行cobbler check后少一需求
systemctl restart cobblerd && systemctl status cobblerd 重启cobbler,并查看状态
cobbler check 查看cobbler启动需求 应该相比上一次执行cobbler check后少一需求
vi /etc/cobbler/modules.conf 修改 module = authn_configfile
htdigest /etc/cobbler/users.digest “Cobbler” cobbler 通过htdigest命令将"Cobbler"(用户组和属性域)中cobbler (用户名,可以起个你喜欢的名字,如Spinach)存到/etc/cobbler/users.digest文件中[注键入后会让你设定密码,设定即可],此时密码设置为12345678
systemctl restart cobblerd && systemctl status cobblerd 重启cobbler,并查看状态
cobbler sync 服务同步
cobbler check 查看cobbler启动需求 最后显示结果如下图2
图1 此中配置ip网段问题是根据本人的hostname ip配置 请自行按照所需配置
图2 最后cobbler check后显示的只有1个需求 而此需求是debian的镜像包没有安装,如果不安装 debian,这条忽略
https://172.16.247.206/cobbler_web 登陆cobbler_web 172.16.247.206是本人hostname的ip [注:账号:上面设置的是cobbler;密码:自己设定的]

发布了53 篇原创文章 · 获赞 23 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/bocai8058/article/details/95651779
今日推荐