Cobbler部署介绍

第1章 cobbler安装部署

1.1 Cobbler介绍

Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。

Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。

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

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

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

1.1.1 Cobbler集成的服务

  • PXE服务支持
  • DHCP服务管理
  • DNS服务管理(可选bind,dnsmasq)
  • 电源管理
  • Kickstart服务支持
  • YUM仓库管理
  • TFTP(PXE启动时需要)
  • Apache(提供kickstart的安装源,并提供定制化的kickstart配置)

1.2 系统环境准备

同kickstart系统环境准备。

1.3 安装cobbler

1.3.1 安装cobbler-web依赖源

[root@m01 ~]# yum localinstall -y http://ftp.linux.ncsu.edu/pub/epel/6/x86_64/Django14-1.4.21-1.el6.noarch.rpm
# 或者(如果外网环境不好可以使用内网yum源)
[root@m01 ~]# yum localinstall -y http://10.0.0.90/epel/6/x86_64/Django14-1.4.21-1.el6.noarch.rpm

1.3.2 安装cobbler相关软件

[root@m01 ~]# yum install -y cobbler cobbler-web dhcp tftp-server pykickstart httpd

1.3.3 cobbler安装文件说明

[root@m01 ~]# 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日志

1.3.4 启动服务

[root@m01 ~]# service httpd restart     # 重启apache服务
[root@m01 ~]# service cobblerd start    # 启动cobbler服务

1.4 下载cobbler启动文件

[root@m01 ~]# cobbler get-loaders
# 或预先下载相关文件后上传到服务器
[root@m01 ~]# wget http://192.168.12.200/cobbler/cobbler_load.tar.gz
[root@m01 ~]# tar xfP cobbler_load.tar.gz

1.5 配置DHCP

修改cobbler的dhcp模版,不要直接修改dhcp本身的配置文件,因为cobbler会覆盖。

[root@m01 ~]# vim /etc/cobbler/dhcp.template
 21 subnet 10.0.0.0 netmask 255.255.255.0 {
 22      option routers             10.0.0.254;
 23      option domain-name-servers 10.0.0.254;
 24      option subnet-mask         255.255.255.0;
 25      range dynamic-bootp        10.0.0.150 10.0.0.200;
# 或
[root@m01 ~]# cp /etc/cobbler/dhcp.template{,.bak}
# 下面的命令只可执行一次,不可多次执行,否则配置文件会被损坏
[root@m01 ~]# sed -i 's#192.168.1#172.16.1#g;22d;23d' /etc/cobbler/dhcp.template
注意:刚安装完dhcp时无法启动服务,因为dhcp配置文件未编写,需要待cobbler同步后方可启动dhcp服务。

1.6 配置Cobbler

1.6.1 cobbler自查配置

# 检查Cobbler的配置,如果看不到下面的结果,再次执行/etc/init.d/cobblerd restart
[root@m01 ~]# cobbler check
The following are potential configuration items that you may want to fix:

1 : service dhcpd is not running
2 : change 'disable' to 'no' in /etc/xinetd.d/tftp
3 : 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.
4 : 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.
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

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

1.6.2 解决第1个问题

此时只配置了DHCP模板,但DHCP配置文件还没有更改,所以无法直接启动DHCP服务,只要之后cobbler同步一次即可解决问题:

[root@m01 ~]# cobbler sync

1.6.3 解决第2个问题

[root@cobbler ~]# vim /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot
        disable                 = no            # 将yes改为no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

1.6.4 解决第3、4、8个问题

[root@m01 ~]# cp /etc/cobbler/settings{,.bak}   # 备份配置文件

# 生成加密密码,random-phrase-here为干扰码,可以自行设定。
[root@m01 ~]# openssl passwd -1 -salt 'oldboy' '123456'
$1$oldboy$Npg9Pt9k98Mlg0ZeqHAuN1

[root@m01 ~]# vim /etc/cobbler/settings
# 设置新装系统的默认root密码123456。
101 default_password_crypted: "$1$oldboy$Npg9Pt9k98Mlg0ZeqHAuN1"
# 用Cobbler管理DHCP
242 manage_dhcp: 1         
# 如果用Cobbler管理DHCP,修改本项,作用参看kickstart。
272 next_server: 10.0.0.61 
# 防止循环装系统,适用于服务器第一启动项是PXE启动。
292 pxe_just_once: 1       
# Cobbler服务器的IP
384 server: 10.0.0.61

1.6.5 解决第5个问题

[root@m01 ~]# vim /etc/xinetd.d/rsync
# default: off
# description: The rsync server is a good addition to an ftp server, as it \
#       allows crc checksumming etc.
service rsync
{
        disable = no                        # 将yes改为no
        flags           = IPv6
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID
}
[root@m01 ~]# service xinetd restart
[root@m01 ~]# service cobblerd restart

1.6.6 批量解决上述问题

sed -i 's/server: 127.0.0.1/server: 172.16.1.101/' /etc/cobbler/settings
sed -i 's/next_server: 127.0.0.1/next_server: 172.16.1.101/' /etc/cobbler/settings
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings
sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
sed -ri "/default_password_crypted/s#(.*: ).*#\1\"`openssl passwd -1 -salt 'oldboy' '123456'`\"#" /etc/cobbler/settings
sed -i 's#yes#no#' /etc/xinetd.d/rsync
sed -i 's#yes#no#' /etc/xinetd.d/tftp

1.6.7 查看更改后结果

[root@m01 loaders]# cobbler check
The following are potential configuration items that you may want to fix:

1 : file /etc/xinetd.d/rsync does not exist     # 程序开发的逻辑错误,即程序bug
2 : debmirror package is not installed, it will be required to manage debian deployments and repositories                                    # 和debian系统相关,不需要
3 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them        # fence电源管理设备相关,不需要

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

1.7 同步cobbler配置

同步最新cobbler配置,它会根据配置自动修改dhcp等服务。

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

1.8 设置相关服务开机启动

启动相关服务并设置开机启动(可选) 与第二种方法二选一

[root@m01 ~]# chkconfig httpd on
[root@m01 ~]# chkconfig xinetd on
[root@m01 ~]# chkconfig cobblerd on
[root@m01 ~]# chkconfig dhcpd on
[root@m01 ~]# service httpd restart
[root@m01 ~]# service xinetd restart
[root@m01 ~]# service cobblerd restart
[root@m01 ~]# service dhcpd restart

1.8.1 编写Cobbler相关服务启动脚本(可选)

[root@m01 ~]# vim /etc/init.d/cobbler
#!/bin/bash
# chkconfig: 345 80 90
# description:cobbler
case \$1 in
  start)
    /etc/init.d/httpd start
    /etc/init.d/xinetd start
    /etc/init.d/dhcpd start
    /etc/init.d/cobblerd start
    ;;
  stop)
    /etc/init.d/httpd stop
    /etc/init.d/xinetd stop
    /etc/init.d/dhcpd stop
    /etc/init.d/cobblerd stop
    ;;
  restart)
    /etc/init.d/httpd restart
    /etc/init.d/xinetd restart
    /etc/init.d/dhcpd restart
    /etc/init.d/cobblerd restart
    ;;
  status)
    /etc/init.d/httpd status
    /etc/init.d/xinetd status
    /etc/init.d/dhcpd status
    /etc/init.d/cobblerd status
    ;;
  sync)
    cobbler sync
    ;;
  *)
    echo "Input error,please in put 'start|stop|restart|status|sync'!"
    exit 2
    ;;
esac
[root@m01 ~]# chmod +x /etc/init.d/cobbler
[root@m01 ~]# chkconfig cobbler on

1.9 cobbler的命令行管理

1.9.1 查看命令帮助

[root@m01 ~]# cobbler
usage
=====
cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ...
        [add|edit|copy|getks*|list|remove|rename|report] [options|--help]
cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validateks|version|signature|get-loaders|hardlink> [options|--help]

[root@m01 ~]# cobbler import --help
Usage: cobbler [options]

Options:
  -h, --help            show this help message and exit
  --arch=ARCH           OS architecture being imported
  --breed=BREED         the breed being imported
  --os-version=OS_VERSION
                        the version being imported
  --path=PATH           local path or rsync location
  --name=NAME           name, ex 'RHEL-5'
  --available-as=AVAILABLE_AS
                        tree is here, don't mirror
  --kickstart=KICKSTART_FILE
                        assign this kickstart file
  --rsync-flags=RSYNC_FLAGS
                        pass additional flags to rsync

cobbler check    # 核对当前设置是否有问题
cobbler list     # 列出所有的cobbler元素
cobbler report   # 列出元素的详细信息
cobbler sync     # 同步配置到数据目录,更改配置最好都要执行下
cobbler reposync # 同步yum仓库
cobbler distro   # 查看导入的发行版系统信息
cobbler system   # 查看添加的系统信息
cobbler profile  # 查看配置信息

1.9.2 修改cobbler提示(可选)

[root@m01 ~]# vim /etc/cobbler/pxe/pxedefault.template
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://www.leon.com    # 修改此处即可
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT $pxe_timeout_profile

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

$pxe_menu_items

MENU end

1.10 CentOS6.x自动部署配置

1.10.1 导入镜像

[root@m01 ~]# mount /dev/cdrom /mnt
[root@m01 ~]# cobbler import --path=/mnt/ --name=CentOS6.9-x86_64 --arch=x86_64
  • 命令说明:
  • –path 镜像路径
  • –name 为安装源定义一个名字
  • –arch 指定安装源是32位、64位、ia64, 目前支持的选项有: x86│x86_64│ia64
  • 安装源的唯一标示就是根据name参数来定义,本例导入成功后,安装源的唯一标示就是:9-x86_64,如果重复,系统会提示导入失败。
[root@m01 ~]# cobbler distro list   # 查看镜像列表
   CentOS6.9-x86_64
# 镜像存放目录,cobbler会将镜像中的所有安装文件拷贝到本地一份,放在/var/www/cobbler/ks_mirror下的CentOS6.9-x86_64目录下。因此/var/www/cobbler目录必须具有足够容纳安装文件的空间。
[root@m01 ~]# cd /var/www/cobbler/ks_mirror/
[root@m01 ks_mirror]# ls
CentOS6.9-x86_64  config
[root@m01 ks_mirror]# ls CentOS6.9-x86_64/
CentOS_BuildTag  isolinux                  RPM-GPG-KEY-CentOS-Debug-6
EFI              Packages                  RPM-GPG-KEY-CentOS-Security-6
EULA             RELEASE-NOTES-en-US.html  RPM-GPG-KEY-CentOS-Testing-6
GPL              repodata                  TRANS.TBL
images           RPM-GPG-KEY-CentOS-6

1.10.2 指定ks.cfg文件及调整内核参数

1.10.2.1 查看cobbler默认配置文件

[root@m01 ~]# cd /var/lib/cobbler/kickstarts/
[root@m01 kickstarts]# ls
default.ks    install_profiles  sample_autoyast.xml  sample_esxi4.ks  sample_old.seed
esxi4-ks.cfg  legacy.ks         sample_end.ks(默认)sample_esxi5.ks  sample.seed
esxi5-ks.cfg  pxerescue.ks      sample_esx4.ks       sample.ks

1.10.2.2 编辑cobbler配置文件

# 在第一次导入系统镜像后,Cobbler会给镜像指定一个默认的kickstart自动安装文件
# 在/var/lib/cobbler/kickstarts下的sample_end.ks。
[root@m01 kickstarts]# vim /var/lib/cobbler/kickstarts/CentOS6.9-x86_64.cfg
# Cobbler for Kickstart Configurator for CentOS 6.9 by Leon
install
url --url=$tree
text
lang en_US.UTF-8
keyboard us
zerombr
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
$SNIPPET('network_config')
timezone --utc Asia/Shanghai
authconfig --enableshadow --passalgo=sha512
rootpw  --iscrypted $default_password_crypted
clearpart --all --initlabel
part /boot --fstype=ext4 --asprimary --size=200
part swap --size=1024
part / --fstype=ext4 --grow --asprimary --size=200
firstboot --disable
selinux --disabled
firewall --disabled
logging --level=info
reboot

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

%packages
@base
@compat-libraries
@debugging
@development
tree
nmap
sysstat
lrzsz
dos2unix
telnet
%end

%post --nochroot
$SNIPPET('log_ks_post_nochroot')
%end

%post --nochroot
$SNIPPET('log_ks_post_nochroot')
%end

%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
%end

1.10.2.3 查看cobbler信息列表

[root@m01 ~]# cobbler list
distros:
   CentOS6.9-x86_64

profiles:
   CentOS6.9-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

1.10.2.4 查看安装镜像文件信息

[root@m01 ~]# cobbler distro report --name=CentOS6.9-x86_64
Name                           : CentOS6.9-x86_64
Architecture                   : x86_64
TFTP Boot Files                : {}
Breed                          : redhat
Comment                        :
Fetchable Files                : {}
Initrd                         : /var/www/cobbler/ks_mirror/CentOS6.9-x86_64/images/pxeboot/initrd.img
Kernel                         : /var/www/cobbler/ks_mirror/CentOS6.9-x86_64/images/pxeboot/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : {'tree': 'http://@@http_server@@/cblr/links/CentOS6.9-x86_64'}
Management Classes             : []
OS Version                     : rhel6
Owners                         : ['admin']
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Template Files                 : {}

1.10.2.5 查看所有的profile设置[指定的profile设置]

[root@m01 ~]# cobbler profile report [--name=CentOS6.9-x86_64]
Name                           : CentOS6.9-x86_64
TFTP Boot Files                : {}
Comment                        :
DHCP Tag                       : default
Distribution                   : CentOS6.9-x86_64
Enable gPXE                    : 0
Enable PXE Menu                : 1
Fetchable Files                : {}
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/sample_end.ks
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 :
Internal proxy                 :
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      :
Virt RAM (MB)                  : 512
Virt Type                      : kvm

1.10.3 修改关联的ks文件

[root@m01 kickstarts]# cobbler profile edit --name=CentOS6.9-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS6.9-x86_64.cfg
# 每次修改完都要同步一次
[root@m01 kickstarts]# cobbler sync

1.11 CentOS7.x自动部署配置

1.11.1 导入镜像

[root@m01 ~]# mount /dev/cdrom /mnt
[root@m01 ~]# cobbler import --path=/mnt/ --name=CentOS7.2-x86_64 --arch=x86_64

1.11.2 编辑CentOS7的ks.cfg文件

1.11.2.1 文本界面的ks.cfg

[root@m01 ~]# vim /var/lib/cobbler/kickstarts/CentOS7.2-text-x86_64.cfg
# Cobbler for Kickstart Configurator for CentOS 7.2 by Leon

authconfig --enableshadow --passalgo=sha512
install
url --url=$tree
text
ignoredisk --only-use=sda
lang en_US.UTF-8
keyboard --vckeymap=us --xlayouts='us'

$SNIPPET('network_config')
network  --hostname=CentOS7
rootpw  --iscrypted $default_password_crypted
services --disabled="chronyd"
timezone Asia/Shanghai --isUtc --nontp
bootloader --location=mbr --boot-drive=sda
zerombr
clearpart --all --initlabel
part /boot --fstype="xfs" --ondisk=sda --size=1024
part swap --fstype="swap" --ondisk=sda --size=1024
part / --fstype="xfs" --grow --ondisk=sda --size=18431
selinux --disabled
firewall --disabled
logging --level=info
reboot

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

%packages
@^minimal
@compat-libraries
@core
@debugging
@development
tree
nmap
sysstat
lrzsz
dos2unix
telnet
vim
wget
iptraf
ncurses-devel
openssl-devel
zlib-devel
OpenIPMI-tools
screen
net-tools
bash-completion
nc
htop
nethogs
%end

%addon com_redhat_kdump --disable --reserve-mb='auto'
%end

%post --nochroot
$SNIPPET('log_ks_post_nochroot')
%end

%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
%end

1.11.2.2 图形界面的ks.cfg

[root@m01 ~]# vim /var/lib/cobbler/kickstarts/CentOS7.2-GUI-x86_64.cfg
# Cobbler for Kickstart Configurator for CentOS 7.2 by Leon

authconfig --enableshadow --passalgo=sha512
install
url --url=$tree
text
ignoredisk --only-use=sda
lang en_US.UTF-8
keyboard --vckeymap=us --xlayouts='us'

$SNIPPET('network_config')
network  --hostname=CentOS7

# Root password
rootpw  --iscrypted $default_password_crypted
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
user --name=leon --password=$6$S6wk2okXhl/Sw99S$p6GEMy4fARjSIX4IG5ilhLbl7Fuu7bcw7fBPzILVB8p0v/kJvBpLwlCAjEFQeHfaiOE.d0cv/RkKfyRO9rVXB/ --iscrypted --gecos="Leon"
# X Window System configuration information
xconfig  --startxonboot
# License agreement
eula --agreed
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda --append="crashkernel=auto rhgb quiet"
# Partition clearing information
zerombr
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="xfs" --ondisk=sda --size=1024
part swap --fstype="swap" --ondisk=sda --size=1024
part / --fstype="xfs" --grow --ondisk=sda --size=18431
# Set system security
selinux --disabled
firewall --disabled
logging --level=info
reboot

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

%packages
@^gnome-desktop-environment
@base
@compat-libraries
@core
@desktop-debugging
@development
@dial-up
@directory-client
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@input-methods
@internet-browser
@java-platform
@multimedia
@network-file-system-client
@networkmanager-submodules
@print-client
@x11
tree
nmap
dos2unix
telnet
iptraf
ncurses-devel
openssl-devel
zlib-devel
OpenIPMI-tools
screen
tigervnc-server
%end

%addon com_redhat_kdump --disable --reserve-mb='auto'
%end

%post --nochroot
$SNIPPET('log_ks_post_nochroot')
%end

%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
%end

1.11.13重命名CentOS7.2-x86_64的profile文件

图片[1]|Cobbler部署介绍|leon的博客

1.11.4 制作新的GUI profile文件

图片[2]|Cobbler部署介绍|leon的博客

图片[3]|Cobbler部署介绍|leon的博客

图片[4]|Cobbler部署介绍|leon的博客

图片[5]|Cobbler部署介绍|leon的博客

1.12 自动化安装系统

图片[6]|Cobbler部署介绍|leon的博客

图片[7]|Cobbler部署介绍|leon的博客

如上图:此时如果有多个系统则会显示在此处,手动选择需要安装的系统即可,或直接在ks.cfg文件中定义要安装的系统。

图片[8]|Cobbler部署介绍|leon的博客

图片[9]|Cobbler部署介绍|leon的博客

图片[10]|Cobbler部署介绍|leon的博客

图片[11]|Cobbler部署介绍|leon的博客

图片[12]|Cobbler部署介绍|leon的博客

图片[13]|Cobbler部署介绍|leon的博客

图片[14]|Cobbler部署介绍|leon的博客

1.13 查看安装结果

图片[15]|Cobbler部署介绍|leon的博客

1.14 定制化安装

1.14.1 区分物理机的方式

区分一台服务器的最简单的方法就是物理MAC地址,物理服务器的MAC地址书写在服务器上的标签,虚拟机的MAC查看方式:

图片[16]|Cobbler部署介绍|leon的博客

1.14.2 进行定制化安装

[root@m01 ~]# cobbler system add --name=Leon --mac=00:50:56:2C:76:77 --profile=CentOS7.4-x86_64 --ip-address=10.0.0.111 --subnet=255.255.255.0 --gateway=10.0.0.254 --interface=eth0 --static=1 --hostname=Test --name-servers="223.5.5.5 223.6.6.6"      # --name 自定义但不能重复
[root@m01 ~]# cobbler system list                       # 查看定义的列表
   Leon
[root@cobbler ~]# cobbler sync

此时开机安装会为MAC地址为00:50:56:2C:76:77的物理机自动安装CentOS7.4,不需要自己再选择要安装的系统了。

第2章 Cobbler的Web管理

2.1 登录cobbler-web界面

图片[17]|Cobbler部署介绍|leon的博客

图片[18]|Cobbler部署介绍|leon的博客

2.2 导入光盘镜像

2.2.1 导入镜像

图片[19]|Cobbler部署介绍|leon的博客

2.2.2 查看导入日志

图片[20]|Cobbler部署介绍|leon的博客

2.2.3 查看导入结果

图片[21]|Cobbler部署介绍|leon的博客

图片[22]|Cobbler部署介绍|leon的博客

图片[23]|Cobbler部署介绍|leon的博客

图片[24]|Cobbler部署介绍|leon的博客

2.3 导入ks文件模板

图片[25]|Cobbler部署介绍|leon的博客

图片[26]|Cobbler部署介绍|leon的博客

2.4 自定义安装系统

图片[25]|Cobbler部署介绍|leon的博客

图片[28]|Cobbler部署介绍|leon的博客

图片[29]|Cobbler部署介绍|leon的博客

图片[30]|Cobbler部署介绍|leon的博客

图片[31]|Cobbler部署介绍|leon的博客

2.5 再次开启网络启动

图片[32]|Cobbler部署介绍|leon的博客

2.6 同步配置

图片[33]|Cobbler部署介绍|leon的博客

温馨提示:本文最后更新于2022-12-20 20:57:55,已超过431天没有更新。某些文章具有时效性,若文章内容或图片资源有错误或已失效,请联系站长。谢谢!
转载请注明本文链接:https://blog.leonshadow.cn/763482/220.html
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享