环境说明

系统版本    CentOS 6.9 x86_64

Cobbler是一款Linux安装服务器,可以快速设置网络安装环境。它粘合在一起并自动执行许多相关的Linux任务,因此部署新系统时不必在许多不同的命令和应用程序之间跳转,并且在某些情况下更改现有的命令和应用程序。Cobbler可以帮助进行配置,管理DNS和DHCP,软件包更新,电源管理,配置管理编排等等,Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。

Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。

Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack。

cobbler官网http://cobbler.github.io/

1、安装

clbbler需要先配置epel源

yum -y install cobbler cobbler-web dhcp

需要手动安装Django

[root@cobbler ~]# yum localinstall Django14-1.4.21-1.el6.noarch.rpm

[root@cobbler ~]# rpm -ql cobbler # 查看安装的文件,下面列出部分。

/etc/cobbler # 配置文件目录

/etc/cobbler/settings # cobbler主配置文件,这个文件是YAML格式,Cobbler是python写的程序。

/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模块配置文件

/var/lib/cobbler # Cobbler数据目录

/var/lib/cobbler/config # 配置文件

/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日志

2、配置

2.1、配置cobbler

[root@cobbler ~]# /etc/init.d/httpd start    #启动httpd

正在启动 httpd:httpd: apr_sockaddr_info_get() failed for cobbler

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

[确定]

[root@cobbler ~]# cobbler check    #检查Cobbler的配置

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

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.

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.

3 : change 'disable' to 'no' in /etc/xinetd.d/tftp

4 : 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.

5 : change 'disable' to 'no' in /etc/xinetd.d/rsync

6 : debmirror package is not installed, it will be required to manage debian deployments and repositories

7 : ksvalidator was not found, install pykickstart

8 : 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 one

9 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

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

接下来一步步解决检查的错误提示

[root@cobbler ~]# vim /etc/cobbler/settings    #解决提示1和提示2

384 server: 192.168.1.62

272 next_server: 192.168.1.62

[root@cobbler ~]# /etc/init.d/cobblerd restart

Stopping cobbler daemon: [确定]

Starting cobbler daemon: [确定]

[root@cobbler ~]# vim /etc/xinetd.d/tftp        #解决提示3

disable = no

[root@cobbler ~]# cobbler get-loaders            #解决提示4

task started: 2018-06-05_201440_get_loaders

task started (id=Download Bootloader Content, time=Tue Jun 5 20:14:40 2018)

path /var/lib/cobbler/loaders/README already exists, not overwriting existing content, use --force if you wish to update

path /var/lib/cobbler/loaders/COPYING.elilo already exists, not overwriting existing content, use --force if you wish to update

path /var/lib/cobbler/loaders/COPYING.yaboot already exists, not overwriting existing content, use --force if you wish to update

path /var/lib/cobbler/loaders/COPYING.syslinux already exists, not overwriting existing content, use --force if you wish to update

path /var/lib/cobbler/loaders/elilo-ia64.efi already exists, not overwriting existing content, use --force if you wish to update

path /var/lib/cobbler/loaders/yaboot already exists, not overwriting existing content, use --force if you wish to update

path /var/lib/cobbler/loaders/pxelinux.0 already exists, not overwriting existing content, use --force if you wish to update

path /var/lib/cobbler/loaders/menu.c32 already exists, not overwriting existing content, use --force if you wish to update

path /var/lib/cobbler/loaders/grub-x86.efi already exists, not overwriting existing content, use --force if you wish to update

path /var/lib/cobbler/loaders/grub-x86_64.efi already exists, not overwriting existing content, use --force if you wish to update

*** TASK COMPLETE ***

[root@cobbler ~]# vim /etc/xinetd.d/rsync        #解决提示5

disable = no

[root@cobbler ~]# /etc/init.d/xinetd restart

停止 xinetd: [确定]

正在启动 xinetd: [确定]

[root@cobbler ~]# yum install debmirror -y        #解决提示6,管理debian服务器

[root@cobbler ~]# 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 support

2 : comment out 'arches' on /etc/debmirror.conf for proper debian support

3 : ksvalidator was not found, install pykickstart

4 : 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 one

5 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

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

[root@cobbler ~]# vim /etc/debmirror.conf

#@dists="sid";

@sections="main,main/debian-installer,contrib,non-free";

#@arches="i386";

[root@cobbler ~]# yum install -y pykickstart    #解决提示3

[root@cobbler ~]# openssl passwd -1 -salt 'random' '123456'

$1$random$lNO5K9IqIbuZDaMsncC6/1

[root@cobbler ~]# vim /etc/cobbler/settings    #解决提示4

# 设置新装系统的默认root密码123456。下面的命令来源于提示6。random为(掩码)干扰码,可以自行设定。

101 default_password_crypted: "$1$random$lNO5K9IqIbuZDaMsncC6/1"

[root@cobbler ~]# yum install cman -y            #解决提示5

[root@cobbler ~]# /etc/init.d/cobblerd restart        #重启cobbler

Stopping cobbler daemon: [确定]

Starting cobbler daemon: [确定]

[root@cobbler ~]# cobbler check

No configuration problems found. All systems go.

2.2、配置dhcp

[root@cobbler ~]# vim /etc/cobbler/settings

242 manage_dhcp: 1    #配置cobbler接管dhcp

[root@cobbler ~]# vim /etc/cobbler/dhcp.template    #修改cobbler的dhcp配置文件

subnet 192.168.1.0 netmask 255.255.255.0 {

option routers 192.168.1.62;    #网关地址

option domain-name-servers 223.5.5.5;        #dns地址

option subnet-mask 255.255.255.0;

2.3、同步cobbler配置

[root@cobbler ~]# cobbler sync

[root@cobbler ~]# netstat -lntup

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1158/sshd

tcp 0 0 127.0.0.1:25151 0.0.0.0:* LISTEN 21912/python

tcp 0 0 :::873 :::* LISTEN 19939/xinetd

tcp 0 0 :::80 :::* LISTEN 1492/httpd

tcp 0 0 :::22 :::* LISTEN 1158/sshd

tcp 0 0 :::443 :::* LISTEN 1492/httpd

udp 0 0 0.0.0.0:67 0.0.0.0:* 21969/dhcpd

udp 0 0 0.0.0.0:69 0.0.0.0:* 19939/xinetd

3、配置cobbler为路由器,

配置cobbler为路由器,使安装的机器能以cobbler为网关上网

[root@cobbler ~]# vim /etc/sysctl.conf

net.ipv4.ip_forward = 1

[root@cobbler ~]# sysctl -p

[root@cobbler ~]# iptables -F

[root@cobbler ~]# iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE

4、cobbler-web操作

浏览器访问http://10.0.0.62/cobbler_web 默认用户名cobbler密码cobbler

Centos7访问地址要使用https

4.1、导入光盘镜像

机器插入光盘,系统挂载(以当前最新的CentOS-7-x86_64-DVD-1804为例)

[root@cobbler ~]# mount /dev/cdrom /mnt

mount: block device /dev/sr0 is write-protected, mounting read-only

4.2、在web界面操作

导入镜像,执行run,后台会通过rsync进行同步,需要等待一段时间(若需要导入多个系统镜像,需要先卸载,再进行挂载导入)

编辑配置文件Profile

a、为dvd指定ks文件,可以使用系统的ks文件,也可以手动上传

另外一种方式是通过命令指定关联的ks文件

cobbler profile edit --name=CentOS7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ cobbler_centos7.ks

b、对于centOS 7需要在安装的时候添加内核参数及指定分辨率net.ifnames=0 biosdevname=0 vga=0x340

另外一种方式是通过命令指定关联的ks文件

cobbler profile edit --name=CentOS7-x86_64 --kopts='net.ifnames=0 biosdevname=0 vga=0x340'

同步配置

5、开始装系统

新建机器,与cobbler服务器同网络类型,开机进行装系统

温馨提示:CentOS 7.4以上的系统在安装的时候内存需要大于等于2G,不然会出现以下错误

6、附

6.1、命令行查看相关信息

[root@cobbler ~]# cobbler distro report --name=CentOS7-x86_64        #查看安装镜像文件信息

[root@cobbler ~]# cobbler profile report        #查看所有的profile设置

[root@cobbler ~]# cobbler profile report --name=CentOS7-x86_64        #查看指定的profile设置

6.2、修改安装时的地址

[root@cobbler ~]# vim /etc/cobbler/pxe/pxedefault.template

MENU TITLE Cobbler | http://www.ssgeek.com

[root@cobbler ~]# cobbler sync    #同步配置

修改前

修改后

6.3、定制化安装

即为指定的主机安装指定的系统,设置主机名,ip,网关,,网卡名、dns等,开机自动选择,不需要询问手动选择

另外一种方式是通过命令来指定镜像,设置相关信息

[root@cobbler ~]# cobbler system add --name=test --mac=00:0C:29:9C:9D:23 --profile=CentOS7-x86_64 --ip-address=192.168.1.110 --subnet=255.255.255.0 --gateway=192.168.1.62 --interface=eth0 --static=1 --hostname=test --name-servers="223.5.5.5"        #--name 自定义,但不能重复

[root@cobbler ~]# cobbler sync    #同步配置

[root@cobbler ~]# cobbler system list        #查看定义的列表

Test

开机后自动安装,跳过了选择页面

6.4、设置cobbler的web界面密码

/etc/cobbler/users.conf # Web服务授权配置文件

/etc/cobbler/users.digest # 用于web访问的用户名密码配置文件

#在Cobbler组添加cobbler用户,提示输入2遍密码确认

[root@cobbler ~]# htdigest /etc/cobbler/users.digest "Cobbler" cobbler

Changing password for user cobbler in realm Cobbler

New password: 123456

Re-type new password: 123456

[root@cobbler ~]# cobbler sync    #同步配置

6.5、利用Cobbler自建repo源

添加zabbix的repo源(wget方式貌似只能通过zabbix官方的源)

rsync方式rsync://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.0/rhel/7/x86_64/

添加完成后点击Reposync开始同步

做好了repo源,在安装系统的时候可以选择repo源,这样安装好的系统也配置了从该repo源下载,有了cobbler服务器的repo库

6.6、使用cobbler需要启动的服务

可以手动启动也可添加为开机启动项

/etc/init.d/httpd start

/etc/init.d/xinetd start

/etc/init.d/dhcpd start

/etc/init.d/cobblerd restart

部分参考来源:http://www.zyops.com/autoinstall-cobbler/

转载请注明出处

Cobbler无人值守安装系统的更多相关文章

  1. 其他综合-Cobbler无人值守安装系统 CentOS 7

    Cobbler 无人值守安装系统 CentOS 7 1.实验描述 1.1 概述 作为运维,在公司经常遇到一些机械性重复工作要做,例如:为新机器装系统,一台两台机器装系统,可以用光盘.U盘等介质安装,1 ...

  2. CentOS7.x安装cobbler无人值守安装系统

    CentOS7.x cobbler无人值守安装 cobbler介绍 自打若干年前 Red Hat,推出了 Kickstart,不再需要刻了光盘一台一台地安装 Linux,只要搞定 PXE.DHCP.T ...

  3. PXE+Kickstart无人值守安装系统re

    PXE(Preboot Excute Environment)预启动执行环境,可以让计算机通过网络启动系统,主要用于无人值守安装系统中引导客户端主机安装Linux操作系统. 由于之前有过使用cobbl ...

  4. (转)COBBLER无人值守安装

    COBBLER无人值守安装 说在最前面的话 在看Cobbler之前请大家先看一下Kickstart无人值守安装,了解一下Cobbler的实现原理.但是Cobbler是独立的,不需要先安装Kicksta ...

  5. 使用PXE+Kickstart无人值守安装系统

    PXE预启动执行环境(即Preboot execute environment) 是一种能够让计算机通过网络启动的引导方式,只要网卡支持PXE协议即可使用,用于在无人值守安装系统服务中引导客户机安装服 ...

  6. cobbler PXE 安装系统时出现的问题

    cobbler PXE 安装系统时出现的问题 1.安装包未找到.解决方法:ios镜像里没有软件包,换掉该软件包的ios镜像,或者在ks.cfg 文件里删去或注释掉%packages 里指定安装的软件包 ...

  7. 其他综合-Kickstart无人值守安装系统CentOS 7

    Kickstart无人值守安装系统CentOS 7 1.概述 1.1 关于PXE Preboot Execution Environment 翻译过来就是预启动执行环境:简称 PXE :传统安装操作系 ...

  8. Cobbler无人值守安装linux系统

    简介 Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装.重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等. Cobbler可以使用命令行方式管理,也提 ...

  9. cobbler自动化安装系统

    笔者Q:972581034 交流群:605799367.有任何疑问可与笔者或加群交流 在很久很久以前,使用kickstart实现自动化安装的时候,我一直认为装系统是多么高大上的活,直到cobbler的 ...

随机推荐

  1. BZOJ1823 [JSOI2010]满汉全席 【2-sat】

    题目 满汉全席是中国最丰盛的宴客菜肴,有许多种不同的材料透过满族或是汉族的料理方式,呈现在數量繁多的菜色之中.由于菜色众多而繁杂,只有极少數博学多闻技艺高超的厨师能够做出满汉全席,而能够烹饪出经过专家 ...

  2. 在Linux内核中添加系统调用,并编译内核

    1 环境准备 运行系统:vmware下安装的ubuntu10.10 32bit桌面版. 编译内核版本: linux-2.6.32.63 内核目录: /home/wanchouchou/linuxKer ...

  3. mac 安装 navicat premium11.2.1400 破解版

    前言: 在 Mac 系统下 安装 navicat for mysql 时,遇到注册码的问题,适用了很多破解下载,都没有成功,现找到一篇特此记录下. Mac 下一款实用的数据库管理工具--Navicat ...

  4. vue2.0 v-tap简洁(漏)版 (只解决300ms问题)

    Vue.directive('tap',{ bind:function(el,binding){ var startTx, startTy, endTx, endTy, startTime, endT ...

  5. 封装scroll()

    function scroll(){ if(window.pageYOffset !== undefined){ return { "top": window.pageYOffse ...

  6. js date扩展方法

    /* File Created: 四月 28, 2015 */ //日期加上天数得到新的日期 //dateTemp 需要参加计算的日期,days要添加的天数,返回新的日期,日期格式:YYYY-MM-D ...

  7. [bzoj3158]千钧一发——二分图+网络流

    题目 传送门 题解 很容易建立模型,如果两个点不能匹配,那么连一条边,那么问题就转化为了求一个图上的最大点权独立集. 而我们可以知道: 最大点权独立集+最小点权覆盖集=总权值. 同时最小点权覆盖在一般 ...

  8. 转 Join的实现原理及优化思路

    前言 前面我们已经了解了MySQLQueryOptimizer的工作原理,学习了Query优化的基本原则和思路,理解了索引选择的技巧,这一节我们将围绕Query语句中使用非常频繁,且随时可能存在性能隐 ...

  9. Android wifi驱动的移植 realtek 8188

    Android wifi驱动的移植 一般我们拿到的android源代码中wifi应用层部分是好的, 主要是wifi芯片的驱动要移植并添加进去. wifi驱动的移植, 以realtek的8188etv为 ...

  10. kvm虚拟机最佳实践系列2-创建KVM及KVM优化

    创建KVM及KVM优化 把KVM优化与KVM创建放在一起,是因为我们创建的KVM是要用在生产环境中,所以基础优化工作是必备的. 创建KVM 创建系统盘, 大小: 操作系统通常都不到10G,所以系统盘2 ...