配置部署 Cobbler

系统环境:CentOS7.2+cobbler 2.6.11

一、初始化

1.配置yum epel源、禁用selinux、修改主机名
修改主机名
hostnamectl set-hostname 

[ root@cobbler ~]#vi /etc/yum.repos.d/epel.repo
[epel]
name=epel
mirrorlist= http://mirrors.fedoraproject.org/mirrorlist?repo=epel-$releasever&arch=$basearch
enabled=1
gpgcheck=0

[ root@cobbler  ~]#vi /etc/sysconfig/selinux
SELINUX=disabled
重启服务器
reboot

二、环境配置
2.安装cobbler及相关组件

yum -y install tftp-server cobbler cobbler-web pykickstart debmirror dnsmasq net-tools fence-agents xinetd
3.添加防火墙
centos 7.2 防火墙配置方法
firewall-cmd --permanent --zone=public --add-port=69/udp
firewall-cmd --permanent --zone=public --add-port=53/udp  
firewall-cmd --permanent --zone=public --add-port=80/tcp 
firewall-cmd --permanent --zone=public --add-port=443/tcp 
firewall-cmd --permanent --zone=public --add-port=67/udp 
firewall-cmd --permanent --zone=public --add-port=68/udp 
firewall-cmd --permanent --zone=public --add-port=873/tcp 
重启防火墙
systemctl restart firewalld
重启cobbler服务及其他相关服务
systemctl restart httpd
systemctl restart cobblerd
systemctl restart dnsmasq 
systemctl restart rsyncd
配置开机自启动
systemctl enable dnsmasq
systemctl enable cobblerd
systemctl enable httpd
systemctl enable rsyncd
tftp服务和rsync服务
sed -i '/disable/c\\tdisable\t\t\t= no' /etc/xinetd.d/tftp
systemctl restart xinetd
启动菜单
cobbler get-loaders
web登陆认证
sed -i 's/authn_denyall/authn_configfile/g' /etc/cobbler/modules.conf
设置cobbler  web登陆,用户登陆密码
htdigest /etc/cobbler/users.digest "Cobbler" cobbler



三 调试配置
设置debmirror
注销这两个字段
vi /etc/debmirror.conf

@dists=
@arches=
编辑dnsmasq.template 模板
vi /etc/cobbler/dnsmasq.template 

# Cobbler generated configuration file for dnsmasq
# $date
#

# resolve.conf .. ?
#no-poll
#enable-dbus
read-ethers
addn-hosts = /var/lib/cobbler/cobbler_hosts

dhcp-range=192.168.100.2,192.168.100.200 #修改dhcp地址池
dhcp-option=3,$next_server
dhcp-ignore=tag:!known
dhcp-ignore=#known
no-dhcp-interface=eno33557248
dhcp-lease-max=1000
dhcp-authoritative
dhcp-boot=pxelinux.0
dhcp-boot=net:normalarch,pxelinux.0
dhcp-boot=net:ia64,$elilo
server=192.168.100.1  #dhcp服务器IP
$insert_cobbler_system_definitions

设置模块

/etc/cobbler/modules.conf
让cobbler去管理dnsmasq。默认他是使用bind管理dns,isc实现dhcp。
[dns]#module = manage_bindmodule = manage_dnsmasq[dhcp]#module = manage_iscmodule = manage_dnsmasq

动态更新设置
对于Cobbler来说,有一个重要的功能,就是让你可以不需要手工去编辑setting配置文件,直接使用命令去修改,默认这个功能是不启用,你需要启用。
cd /etc/cobbler/cp settings settings.savesed -i 's/^[[:space:]]\+/ /' /etc/cobbler/settingssed -i 's/allow_dynamic_settings: 0/allow_dynamic_settings: 1/g' /etc/cobbler/settings
重启cobbler服务
systemctl restart cobblerd
查看所有可编辑的参数
这个时候,你就可以通过命令行来编辑配置
cobbler setting report

cobbler setting edit --name=option --value=value
修改seting文件
cobbler登陆服务器地址
cobbler setting edit --name=server --value=192.168.100.1
ks脚本关闭pxe,这样就不会重复安装
cobbler setting edit --name=pxe_just_once --value=1
TFTP服务器 IP地址
cobbler setting edit --name=next_server --value=192.168.100.1


cobbler管理rsync,dhcp,dns
cobbler setting edit --name=manage_rsync --value=1cobbler setting edit --name=manage_dhcp --value=1cobbler setting edit --name=manage_dns --value=1

设置root默认密码
这个设置只针对centos有效。我默认的root密码是:111111
openssl passwd -1 -salt 'random-phrase-here''111111'
$1$random-p$WbZ3JxhRzCS/1Ne4S9g4Z.
编辑
vi /etc/cobbler/settings
#default_password_crypted: $1$mF86/UHC$WvcIcX2t6crBz2onWxyac.
default_password_crypted: $1$random-p$WbZ3JxhRzCS/1Ne4S9g4Z.
添加repo
cobbler repo add --mirror=http://mirrors.ustc.edu.cn/epel/6/x86_64/ \--name=epel6-x86_64 --arch=x86_64 --breed=yumcobbler repo add --mirror=http://mirrors.ustc.edu.cn/epel/testing/6/x86_64/ \--name=epel6-x86_64-testing --arch=x86_64 --breed=yumcobbler repo add --name=Centos6-UPDATES \--mirror=http://mirrors.ustc.edu.cn/centos/6/updates/x86_64/ --arch=x86_64 --breed=yum
mount /dev/cdrom /mnt #挂载光盘
cobbler import --path=/mnt --name=CentOS6.7 --arch=x86_64
添加节点
cobbler system add \--name=CentOS6.7 \--hostname=osinstall \--profile=CentOS6.7-x86_64 \
--interface=eth0 \--mac=00:50:56:84:43:ca\
--ip-address=192.168.100.18 \--subnet=255.255.255.0 \--static=1

创建yum源
/etc/cobbler/pxe/pxedefault.template
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler |  http://www.baidu.com
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT $pxe_timeout_profile

LABEL local
        MENU LABEL (local)
        MENU DEFAULT
        LOCALBOOT -1

$pxe_menu_items

MENU end







  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值