cobbler 自动化安装系统

网络安装服务器套件 Cobbler(补鞋匠)从前,我们一直在做装机民工这份很有前途的职业。自打若干年前 Red Hat 推出了 Kickstart,此后我们顿觉身价倍增。不再需要刻了光盘一台一台地安装 Linux,只要搞定 PXE、DHCP、TFTP,还有那满屏眼花缭乱不知所云的 Kickstart 脚本,我们就可以像哈里波特一样,轻点魔棒,瞬间安装上百台服务器。这一堆花里胡哨的东西可不是一般人都能整明白的,没有大专以上学历,通不过英语四级, 根本别想玩转。总而言之,这是一份多么有前途,多么有技术含量的工作啊。很不幸,Red Hat 最新(Cobbler项目最初在2008年左右发布)发布了网络安装服务器套件 Cobbler(补鞋匠),它已将 Linux 网络安装的技术门槛,从大专以上文化水平,成功降低到初中以下,连补鞋匠都能学会。对于我们这些在装机领域浸淫多年,经验丰富,老骥伏枥,志在千里的民工兄弟们来说,不啻为一个晴天霹雳。

下面演示cobbler的安装

[[email protected] ~]# yum install cobbler cobbler-web dhcp tftp-server pykickstart httpd -y

重新启动apache

[[email protected] ~]#/etc/init.d/httpd restart

启动cobbler

[[email protected] ~]# /etc/init.d/cobblerd start
[[email protected] ~]# /etc/init.d/cobblerd restart

检查安装条件

[[email protected] ~]#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.
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 : file /etc/xinetd.d/rsync does not exist
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
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

以上问题基本上需要解决了才能安装

vi /etc/cobbler/settings

server: 10.89.1.15     (修改为你这台安装cobbler的机器)

next_server: 10.89.1.15 (修改为你这台安装cobbler的机器)

manage_dhcp: 1          (“0”修改为“1”)

default_password_crypted: "$1$oldboy$fXF8f078vI9J/q9XyXA8e/"

注意:以上密码是使用下面的命令生成的

[[email protected] ~]# openssl passwd -1 -salt ‘oldboy‘ ‘oldboy‘
$1$oldboy$fXF8f078vI9J/q9XyXA8e/
[[email protected] ~]#cobbler get-loaders

vim /etc/xinetd.d/rsync

disable                 = no

vim /etc/xinetd.d/tftp

disable                 = no

重新启动一下服务

[[email protected] ~]# /etc/init.d/xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]

[[email protected] ~]# /etc/init.d/cobblerd restart
Stopping cobbler daemon:                                   [  OK  ]
Starting cobbler daemon:                                   [  OK  ]
[[email protected] ~]# vim /etc/cobbler/dhcp.template

此处修改为你的cobbler服务器所在的网段信息

subnet 10.89.1.0 netmask 255.255.255.0 {

option routers             10.89.1.254;   (网关地址)

option domain-name-servers 10.7.10.1;      (DNS地址)

option subnet-mask         255.255.255.0;   (子网掩码)

range dynamic-bootp        10.89.1.100 10.89.1.119;(DHCP自动给机器分配的ip范围)

default-lease-time         21600;

max-lease-time             43200;

next-server                $next_server;

[[email protected] ~]#cobbler check

1.service dhcpd is not running

解决办法

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

#/etc/init.d/cobblerd restart

#cobbler sync

2.file /etc/xinetd.d/rsync does not exist

这个问题可以不用管,最后在检查一下安装环境

[[email protected] kickstarts]# 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
3 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

出现上面的信息就可以安装了

以下以安装一台虚拟机为例

本机先挂载镜像包

[[email protected] ~]#mount /dev/cdrom /mnt

导入镜像包

[[email protected] ~]#cobbler import --path=/mnt/ --name=CentOS-7.3-x86_64 --arch=x86_64

导入后镜像包位于

[[email protected] ~]# cd /var/www/cobbler/ks_mirror/
[[email protected] ks_mirror]# ll
total 8
drwxr-xr-x 8 root root 4096 Dec  5 21:20 CentOS-7.3-x86_64
drwxr-xr-x 2 root root 4096 Apr  5 15:20 config配置

KS文件放置位置

[[email protected] ks_mirror]# cd /var/lib/cobbler/kickstarts/

上传KS配置文件 CentOS-7.3-x86_64.cfg   (**文件中的登录用户名:root 密码:oldboy**)

 #cat CentOS-7.3-x86_64.cfg
#Kickstart Configurator by Alvin
#platform =x86, AMD64, or Inter EM64T
#System language
lang en_US
#System keyboard
keyboard us
#System timezone
timezone Asia/Shanghai
#Root password
rootpw --iscrypted $default_password_crypted
#rootpw --iscrypted $1$ops-node$7hqdpgEmIE7Z0RbtQkxW20
#Use text mode install
text
#Install OS instead of upgrade
install 
#User NFS installation Media
url --url=$tree
#url --url=http://192.168.8.22/CentOS-7.1-x86_64
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part /boot --fstype xfs --size 1024 --ondisk sda
part /swap --size 16384 --ondisk sda
part / --fstype xfs --size 1 --grow --ondisk sda
#System authorization information
auth --useshadow --enablemd5
#Network information
$SNIPPET(‘network_config‘)
#network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Firewall configuration
firewall --disabled
#SELinux configuration
selinux --disabled
#Do not configure XWindows
skipx

%pre
$SNIPPET(‘log_ks_pre‘)
$SNIPPET(‘kickstart_start‘)
$SNIPPET(‘pre_install_network_config‘)
#Enable installation monitoring
$SNIPPET(‘pre_anamon‘)
%end

#Package install information
%packages
@ base
@ core
sysstat
iptraf
ntp
lrzsz
openssl-devel
zlib-devel
OpenIPMI-tools
nmap
screen
%end

%post
systemctl disable postfix.service
%end
[[email protected] kickstarts]# cobbler profile edit --name=CentOS-7.3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-7.3-x86_64.cfg 
[[email protected] kickstarts]# cobbler profile edit --name=CentOS-7.3-x86_64 --kopts=‘net.ifnames=0 biosdevname=0‘

[[email protected] ~]# cobbler sync

设置待安装机器的ip,网关,dns 等信息

[[email protected] ~]# cobbler system add --name=alvin --mac=00:50:56:32:4E:C7 --profile=CentOS-7.3-x86_64 --ip-address=10.89.1.113 --subnet=255.255.255.0 --gateway=10.89.1.254 --interface=eth0 --static=1 --hostname=kk.com --name-servers="8.8.8.8"

注意:网卡地址mac是待安装机器

下面开始安装客户端电脑

  1. 待安装的机器开机
  2. 进入bios设置待安装的电脑从网卡启动
  3. 开始自动安装
时间: 2024-12-05 05:25:11

cobbler 自动化安装系统的相关文章

Cobbler自动化安装系统

现在都知道运维自动化的重要性,尤其是对于在服务器数量按几百台.几千台增加的公司而言,单单是装系统,如果不通过自动化来完成,根本是不可想象的. 运维自动化安装方面,早期一般使用人工配置pxe+dhcp+tftp配合kickstart,现在开源工具就多了,如cobbler,OpenQRM和Spacewalk等,下面我们就来了解其中的一个开源工具cobbler. Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才1

运维自动化之使用Cobbler自动化安装系统

一.Cobbler介绍 1.1关于Cobbler Cobbler是一个快速网络安装linux和windows的服务,使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP.DNS.以及yum仓库.构造系统ISO镜像. Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用. Cobbler客户端Koan支持虚拟机安装和操作系统重新安装,使重装系统更便捷. Cobbler提供以下服务集成: * PXE服务支持 * DHCP服务管理 * DNS服务管理

cobbler自动化安装系统无法修改centos7的主机名问题

参考:https://cobbler.github.io/manuals/2.6.0/3/1/3_-_Systems.html我添加了一个centos7.4的系统镜像,然后绑定了mac地址,并且设置了hostname,但是发现系统可以安装,但是hostname无法设置,经过查看资料,发现centos7使用/etc/hostname或者使用hostnamectl set-hostname xxx 来修改主机名,但是cobbler的hostname 还是在操作/etc/sysconfig/netwo

实验:cobbler自动化安装系统

实验环境:centos6.0 ip地址:192.168.1.109 这里对于cobbler是做什么的,一些cobbler的相关背景不再赘述,你可以访问谷歌详细了解 程序包准备: 安装cobbler需要配置epel源,参考" [[email protected] ~]# cat /etc/yum.repos.d/aliyunepel.repo  [epel] name= aliyun epel library baseurl=http://mirrors.aliyun.com/epel/6/x86

基于cobbler实现自动化安装系统

基于cobbler实现自动化安装系统 环境介绍 centos6.8 为centos6.8提供两块网卡 (非必要) 一块为桥接,方便xshell连接和测试 一块为vmnet3:用来搭建dhcp,tftp,和为客户端提供cobbler服务 前提,(确保安装TFTP,dhcp,rsync) # yum install httpd cobbler cobbler-web pykickstart debmirror 1.启动对应的服务 # service httpd start # service cob

使用cobbler自动化部署系统

一.Cobbler简介 Red Hat 最新(Cobbler项目最初在2008年左右发布)发布了网络安装服务器套件 Cobbler(补鞋匠),它已将 Linux 网络安装的技术门槛,从大专以上文化水平,成功降低到初中以下,连补鞋匠都能学会.I am just joking! 二.Cobbler功能特性 使用 Cobbler,您无需进行人工干预即可安装机器.Cobbler 设置一个 PXE 引导环境(它还可使用 yaboot 支持 PowerPC),并控制与安装相关的所有方面,比如网络引导服务(D

cobbler自动化安装centos6.2

cobbler自动化安装 官网地址: http://www.cobblerd.org 1.安装epel源 #rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm #vim /etc/yum.repos.d/epel.repo 2.安装cobbler组件 #yum -y install cobbler dhcp tftp xinetd httpd syslinux 3.准备ISO直接挂载

简单搭建PXE无人值守自动化安装系统

PXE环境概述 在公司进行批量部署服务器安装方法: Kickstart (PXE+DHCP+TFTP+HTTP) 或 Cobbler 批量装机软件介绍 Kickstart和Cobbler. ??Kickstart是一种无人值守的安装方式.它的工作原理是在安装过程中记录人工干预填写的各种参数,并生成一个名为ks.cfg的文件.如果在自动安装过程中出现要填写参数的情况,安装程序首先会去查找ks.cfg文件,如果找到合适的参数,就采用所找到的参数:如果没有找到合适的参数,便会弹出对话框让安装者手工填写

Cobbler无人值守安装系统史上最细实践文档

本文档来自老男孩教育VIP课程 内部学员总结笔记文档笔记内容,和大家分享! 老男孩教育2016年全干货博客,http://blog.oldboyedu.com Cobbler无人值守安装系统史上最细实践文档 http://blog.oldboyedu.com/autoinstall-cobbler/