CentOS 7上安装和配置Cobbler

  • CentOS 7上安装和配置Cobbler已关闭评论
  • 85 views
  • A+
所属分类:linux

Cobbler是一个免费的开源Linux配置服务器,用于通过网络同时在多个系统上进行无人值守或自动操作系统安装。Cobbler服务器利用DHCPTFTPDNS等服务。在Cobbler OS安装基于Kickstart文件并开始在客户端或系统上安装,必须通过网络或pxe启动系统,其余的东西将由cobbler服务器处理。

在本文中,我们将演示如何在CentOS 7.x上安装和配置Cobbler Server

请参阅以下步骤以获取Cobbler安装:

步骤:1通过运行以下yum命令启用epel存储库

[root@cloudworld ~]# yum install epel-release

步骤:2安装Cobbler及其相关软件包

从终端运行以下命令以安装cobbler及其相关软件包。

[root@cloudworld ~]# yum install cobbler cobbler-web dnsmasq syslinux pykickstart xinetd -y

步骤:3启动Cobbler和Web服务器(httpd)服务

执行以下systemctl命令以启动并启用Cobbler和httpd服务

[root@cloudworld ~]# systemctl start cobblerd ; systemctl enable cobblerd
[root@cloudworld ~]# systemctl start httpd ; systemctl enable httpd

如果启用了SELinux,则将其设置为Permissive模式

[root@cloudworld ~]# setenforce 0

要永久地使SELinux处于许可模式,请在' / etc / sysconfig / selinux '中设置以下参数

SELINUX=permissive

在Case OS防火墙正在运行的情况下,请设置以下防火墙规则。

[root@cloudworld ~]# firewall-cmd --add-port=80/tcp --permanent
success
[root@cloudworld ~]# firewall-cmd --add-port=443/tcp --permanent
success
[root@cloudworld ~]# firewall-cmd --add-service=dhcp --permanent
success
[root@cloudworld ~]# firewall-cmd --add-port=69/tcp --permanent
success
[root@cloudworld ~]# firewall-cmd --add-port=69/udp --permanent
success
[root@cloudworld ~]# firewall-cmd --add-port=4011/udp --permanent
success
[root@cloudworld ~]# firewall-cmd --reload
success
[root@cloudworld ~]#

步骤:4访问Cobbler Web界面

安装完成后,尝试从Web浏览器访问Cobbler。

HTTPS:// <IP地址 - 或主机名 - 皮匠-服务器> / cobbler_web /

在我看来,Cobbler Server的IP地址是“172.168.10.5”,默认用户名是' cobbler ',密码是' cobbler '

CentOS 7上安装和配置Cobbler

Cobbler安装部件已完成,现在进行配置。

Cobbler配置请参考以下步骤:

步骤:5编辑文件/ etc / cobbler / settings

让我们生成加密的root密码

[root@cloudworld ~]# openssl passwd -1
Password:
Verifying - Password:
$1$j9/aR8Et$uovwBsGM.cLGcwR.Nf7Qq0
 [root@cloudworld ~]#

在参数' default_password_crypted '下的设置文件' / etc / cobbler / settings '中更新此加密字符串,并通过将参数值从0更改为1来启用Cobbler的DHCPDNSPXETFTP功能。

指定“TFTP服务器的IP地址next_server ”参数和“鞋匠的服务器IP地址的服务器 ”参数。

[root@cloudworld ~]# vi /etc/cobbler/settings
-------------------------------------------------------
default_password_crypted: "$1$j9/aR8Et$uovwBsGM.cLGcwR.Nf7Qq0"
manage_dhcp: 1
manage_dns: 1
pxe_just_once: 1
next_server: 172.168.10.5
server: 172.168.10.5
--------------------------------------------------------

步骤:6更新'/etc/cobbler/dhcp.template'和'/etc/cobbler/dnsmasq.template'文件

编辑文件'/etc/cobbler/dhcp.template'并根据您的设置更新dhcp服务器的子网

[root@cloudworld ~]# vi /etc/cobbler/dhcp.template 
-----------------------------------------------
subnet 172.168.10.0  netmask 255.255.255.0 {
     option routers             172.168.10.5;
     option domain-name-servers 172.168.10.5;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        172.168.10.80 172.168.10.140;
     default-lease-time         21700;
     max-lease-time             43100;
     next-server                $next_server;

     class "pxeclients" {
          match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
          if option pxe-system-type = 00:02 {
                  filename "ia64/elilo.efi";
          } else if option pxe-system-type = 00:06 {
                  filename "grub/grub-x86.efi";
          } else if option pxe-system-type = 00:07 {
                  filename "grub/grub-x86_64.efi";
          } else {
                  filename "pxelinux.0";
          }
     } 
}
--------------------------------------------

更新文件'/etc/cobbler/dnsmasq.template'中pxe客户端的IP地址范围

[root@cloudworld ~]# vi /etc/cobbler/dnsmasq.template
dhcp-range=172.168.10.80,172.168.10.140

重新启动Cobbler和xinetd服务并将这些更改同步到cobbler。

[root@cloudworld ~]# systemctl restart cobblerd
[root@cloudworld ~]# systemctl restart xinetd ; systemctl enable xinetd
[root@cloudworld ~]# cobbler check ; cobbler sync

挂载ISO文件并将其内容导入到cobbler。

下载或复制CentOS 7的ISO文件并运行under命令将ISO导入Cobbler

[root@cloudworld ~]# mkdir  /mnt/iso
[root@cloudworld ~]# mount -o loop CentOS-7-x86_64-DVD-1511.iso  /mnt/iso/
[root@cloudworld ~]# cobbler import --arch=x86_64 --path=/mnt/iso --name=CentOS7

同样,您可以导入其他Linux风格的ISO文件。如果您在导入时遇到签名错误,请运行以下命令来解决问题

[root@cloudworld ~]# cobbler signature update

步骤:7从命令行和Cobbler Web界面验证Distro列表

从终端运行以下命令以查看Distros列表

[root@cloudworld ~]# cobbler distro list
   CentOS7-x86_64
[root@cloudworld ~]#

我们还可以从Cobbler Web界面查看发行列表。

登录界面进入配置选项卡 - >单击Distros

CentOS 7上安装和配置Cobbler

可以使用以下cobbler命令从命令查看Distro报告:

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

步骤:8为CentOS 7创建Kickstart文件

让我们为CentOS 7创建一个名为' CentOS7.ks '的kickstart文件,kickstart文件的默认位置是' / var / lib / cobbler / kickstarts '

[root@cloudworld ~]# vi /var/lib/cobbler/kickstarts/CentOS7.ks

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use HTTP installation media
url --url="http://172.168.10.5/cblr/links/CentOS7-x86_64/"

# Root password
rootpw --iscrypted $1$j9/aR8Et$uovwBsGM.cLGcwR.Nf7Qq0

# Network information
network --bootproto=dhcp --device=eth0 --onboot=on

# Reboot after installation
reboot

# System authorization information
auth useshadow passalgo=sha512

# Use graphical install
graphical

firstboot disable

# System keyboard
keyboard us

# System language
lang en_US

# SELinux configuration
selinux disabled

# Installation logging level
logging level=info

# System timezone
timezone Europe/Amsterdam

# System bootloader configuration
bootloader location=mbr

clearpart --all --initlabel
part swap --asprimary --fstype="swap" --size=1024
part /boot --fstype xfs --size=500
part pv.01 --size=1 --grow
volgroup root_vg01 pv.01
logvol / --fstype xfs --name=lv_01 --vgname=root_vg01 --size=1 --grow

%packages
@^minimal

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

[root@cloudworld ~]#

最后一步是使用以下cobbler命令将更新的配置文件同步到cobbler服务器:

[root@cloudworld ~]# cobbler profile edit --name=CentOS7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS7.ks
[root@cloudworld ~]# cobbler sync

基本配置现已完成,并使用pxe或网络引导系统并执行安装测试。

步骤:9使用PXE引导客户端

使用要执行自动操作系统安装的pxe引导系统

 

CentOS 7上安装和配置Cobbler

选择操作系统为CentOS7,然后按Enter键。

CentOS 7上安装和配置Cobbler

我们可以看到无人值守的操作系统安装已经开始。

  • 安卓客户端下载
  • 微信扫一扫
  • weinxin
  • 微信公众号
  • 微信公众号扫一扫
  • weinxin
avatar