how to install cobbler on centos 6

举报
JBo 发表于 2021/08/12 08:17:08 2021/08/12
【摘要】 how to install cobbler on centos 6 cobbler quickstart guide Install cobbler Linux Root user password 设置 Cobbler Web访问的密码 测试 Cobbler目录说明 异常问题的收集 how to install cobbler on centos 6 cobbler quickstar...

how to install cobbler on centos 6


cobbler quickstart guide

cobbler软件说明
Cobbler是一个开源项目(补鞋匠),网络安装服务器套件集成了PXE、DHCP、DNS、Kickstart服务管理和yum仓库管理工具,通过配置Cobbler服务器,可以全自动批量安装部署Linux系统。

Cobbler不仅仅是一个pxe服务器,他还可以管理dns和dhcp。相对之前的 Kickstart 更加快捷、方便的批量布署red hat、centos类系统。

在生产环境,是不允许dhcp, 但是pxe需要使用dhcp,所以是可以根据MAC地址来分配IP,这样DHCP就不会影响现有网络了。

源自官网说明 国内需要翻墙 — Bobby 2016/04/02 13:10

实验环境
两台机器,不同网段的cobbler:

所有的服务均部署在同一台服务器上(192.168.31.127)

所有的服务均部署在同一台服务器上(10.81.234.46)

软件要求
cobbler、dhcp、tftp,http、rsync、kickstart

disabled selinux iptables ip6tables
close selinux

# sudo sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config  
# setenforce 0

# sudo chkconfig iptables off
# sudo /etc/init.d/iptables stop

如果你想要开启,请打开TCP:25251、UDP:69

 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT  #Http
 -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 69 -j ACCEPT  #Tftp
 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25151 -j ACCEPT  #Cobbler
# sudo chkconfig ip6tables off
# sudo /etc/init.d/ip6tables stop

Install cobbler relase rpm lib
由于我是在要地测试,我就先安装了开发包

阿里云的yum

# wget http://mirrors.aliyun.com/repo/Centos-6.repo /etc/yum.repos.d/Centos-6.repo

网易的yum

# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo /etc/yum.repos.d/CentOS6-Base-163.repo

epel yum

# wget http://mirrors.aliyun.com/repo/epel.repo /etc/yum.repos.d/epel.repo

此时最后重新启动一下电脑,

# yum clean all
# yum makecache
# yum update
# reboot
# yum groupinstall “Development Tools” -y

我在centos6.7中安装了开发包,导致 python 在同步下载 loaders文件时不能下载。

Install cobbler

# yum install cobbler cobbler-web xinetd pykickstart cman dhcp tftp tftp-server bind -y

Changing settings for cobbler.
dhcpd
tfpd
sync
xinetd
cobbler settings
Starting and Enabling the Cobbler Service

# chkconfig httpd on
# chkconfig cobblerd on
# chkconfig xinetd on
# chkconfig dhcpd on

# service cobblerd start 
# service httpd start
# service xinetd start
# service dhcpd start
# service cobblerd status

此时这里 DHCP 有错误可以先不管,先去设置后再重新启动就没有问题了。

Changing xinetd tftp and rsync config
tftp server disable item from yes to no.

  # vim /etc/xinetd.d/tftp
service tftp
{
        # disable                 = yes
        disable                 = no
rsync server disable item from yes to no.
}
  # vim /etc/xinetd.d/rsync
#       allows crc checksumming etc.
service rsync
{
      #  disable = yes
        disable = no
        flags           = IPv6
}

tftp / rsync has setting done

Linux Root user password

# sudo openssl passwd -1 -salt 'www.jbboo.com' 'test'
  • 1 1 www.jbbo$yfAulCU1H/kZz/MYX69uE.
    # vim /etc/cobbler/settings

可能是在101行处,更换生成的新密码。

  • 101 #default_password_crypted: “ 1 1 mF86/UHC$WvcIcX2t6crBz2onWxyac.”
  • 102 default_password_crypted: “ 1 1 www.jbbo$yfAulCU1H/kZz/MYX69uE.”

设置 Cobbler Web访问的密码

# sudo htdigest /etc/cobbler/users.digest "Cobbler" admin
Adding user admin in realm Cobbler
New password:   
Re-type new password:  
changing Server and Next_Server

next_server:

270 # if using cobbler with manage_dhcp, put the IP address
271 # of the cobbler server here so that PXE booting guests can find it
272 # if you do not set this correctly, this will be manifested in TFTP open timeouts.
273 #next_server: 127.0.0.1
274 next_server: 10.81.234.46
server:

380 # this is the address of the cobbler server -- as it is used
381 # by systems during the install process, it must be the address
382 # or hostname of the system as those systems can see the server.
383 # if you have a server that appears differently to different subnets
384 # (dual homed, etc), you need to read the --server-override section
385 # of the manpage for how that works.
386 server: 10.81.234.46
387 #server: 127.0.0.1
manage dhcp

241 # set to 1 to enable Cobbler's DHCP management features.
242 # the choice of DHCP management engine is in /etc/cobbler/modules.conf
243 manage_dhcp: 1
manage rsync

261 # set to 1 to enable Cobbler's RSYNC management features.
262 manage_rsync: 1
manage TFTP

258 # set to 1 to enable Cobbler's TFTP management features.
259 # the choice of TFTP mangement engine is in /etc/cobbler/modules.conf
260 manage_tftpd: 1
only start once, cobbler program.

# if this setting is set to 1, cobbler systems that pxe boot
# will request at the end of their installation to toggle the
# --netboot-enabled record in the cobbler system record.  This eliminates
# the potential for a PXE boot loop if the system is set to PXE
# first in it's BIOS order.  Enable this if PXE is first in your BIOS
# boot order, otherwise leave this disabled.   See the manpage
# for --netboot-enabled.
pxe_just_once: 1
DHCP Management
manage dhcp



	 13 allow booting;
	 14 allow bootp;
	 15
	 16 ignore client-updates;
	 17 set	vendorclass = option vendor-class-identifier;
	 18
	 19 option pxe-system-type code	93 = unsigned integer 16;
	 20
	 21 subnet 192.168.31.0 netmask 255.255.255.0 {
	 22	 option	routers		    192.168.31.1;
	 23	 option	domain-name-servers 192.168.31.127;
	 24	 option	subnet-mask	    255.255.255.0;

         25 #    range dynamic-bootp	    192.168.31.100 192.168.31.254;

            #    网络中己经有了DHCP 服务器,所以这里要禁止分配,只给正确的 MAC 地址的电脑分配 IP.
	 26	 default-lease-time	    21600;
	 27	 max-lease-time		    43200;
	 28	 next-server		    "192.168.31.127";
	 29 #	 next-server		    $next_server;
	 30	 class "pxeclients" {
	 31	      match if substring (option vendor-class-identifier, 0, 9)	= "PXEClient";
	 32	      if option	pxe-system-type	= 00:02	{
	 33		      filename "ia64/elilo.efi";
	 34	      }	else if	option pxe-system-type = 00:06 {
	 35		      filename "grub/grub-x86.efi";
	 36	      }	else if	option pxe-system-type = 00:07 {
	 37		      filename "grub/grub-x86_64.efi";
	 38	      }	else {
	 39		      filename "pxelinux.0";
	 40	      }
	 41	 }
	 42
	 43   #  为指定 MACIP 地址为 【192.168.31.12044	host test {
	 45
	 46	    hardware ethernet 03:00:27:A7;12:24;
	 47	    fixed-address 192.168.31.120;
	 48
	 49    }
	 50
	 51 }
Check Files and restart servers

    # ll /var /etc/cobber/ks_mirror
    # sudo service xinetd restart  
    # sudo service httpd restart  
    # sudo service cobblerd restart 

Checking for Problems and Your First Sync
cobbler check

    # sudo cobbler get-loaders
task started: 2016-04-02_235933_get_loaders
task started (id=Download Bootloader Content, time=Sat Apr  2 23:59:33 2016)
downloading http://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
downloading http://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading http://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading http://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading http://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading http://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading http://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading http://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading http://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading http://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***

Importing Your First Distribution

# ll /usr/local/src/centos6.5_x86_64
# mount -t iso9660 -o loop,ro /path/to/isos/centos6.5_x86_64.iso /media/ct6

# cobbler import --name=centos6.5 --arch=x86_64 --path=/media/ct6

# cobbler distro list
# cobbler profile list

–name 为安装源定义一个名字

–arch 指定安装源是32位还是64位, 目前支持的选项有: x86│x86_64│ia64

cobbler check problem

# cobbler check

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

1 : file /etc/xinetd.d/rsync does not exist

2 : debmirror package is not installed, it will be required to manage debian deployments and repositories
Restart cobblerd and then run ‘cobbler sync’ to apply changes.
cobbler sync

# sudo cobbler sync
  1. Views distro details
  2. cobbler distro report –name=centos6.5-x86_64

测试

test client install linux system. [ network pxe boot ]

Cobbler目录说明

Cobbler配置文件目录:/etc/cobbler

/etc/cobbler/settings          ##cobbler主配置文件
/etc/cobbler/dhcp.template      ##DHCP服务的配置模板
/etc/cobbler/tftpd.template       ##tftp服务的配置模板
/etc/cobbler/rsync.template        ##rsync服务的配置模板
/etc/cobbler/iso                 ##iso模板配置文件
/etc/cobbler/pxe                   ##pxe模板文件
/etc/cobbler/power          ##电源的配置文件
/etc/cobbler/users.conf       ##Web服务授权配置文件
/etc/cobbler/users.digest       ##用于web访问的用户名密码配置文件
/etc/cobbler/dnsmasq.template     ##DNS服务的配置模板
/etc/cobbler/modules.conf           ##Cobbler模块配置文件
Cobbler数据目录:/var/lib/cobbler

/var/lib/cobbler/config              ##配置文件
/var/lib/cobbler/triggers          ##Cobbler命令
/var/lib/cobbler/kickstarts        ##默认存放kickstart文件
/var/lib/cobbler/loaders             ##存放的各种引导程序
系统安装镜像目录:/var/www/cobbler

/var/www/cobbler/ks_mirror               ##导入的系统镜像列表
/var/www/cobbler/images             ##导入的系统镜像启动文件
/var/www/cobbler/repo_mirror            ##yum源存储目录
日志目录:/var/log/cobbler

/var/log/cobbler/install.log         ##客户端系统安装日志
/var/log/cobbler/cobbler.log           ##cobbler日志

异常问题的收集

  • PXE-E32:TFTP open timeout PXE-M0F:Exiting Inter PXE ROM operating system not found

      原因:iptables未关闭
    
  • 最小化安装的centos无法使用ifconfig命令,使用ip addr查看DHCP分配地址

      # yum install net-tools
    
  • debmirror package is not installed, it will be required to manage debian deployments and repositories

      deb system.don't need it.(如果不是安装 debian 之类的系统,此提示可以忽略)
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。