服务器部署网站需要装tomk,实战-使用 Cobbler 定制化安装指定系统

搭建好 Cobbler 服务器后,我们需要先新建一个 VM 虚拟机,获取 MAC地址。定制主机配置是根据 MAC 地址来识别主机的。

环境:

CentOS Linux release 7.6.1810

VMware Workstation Pro 14

新建VM 虚拟机

实战-使用 Cobbler 定制化安装指定系统实战-使用 Cobbler 定制化安装指定系统

MAC 地址为 00:50:56:3E:F0:C6

使用 Cobbler 安装系统时,指定好系统的 IP地址,镜像,网关,主机名等信息

[root@localhost kickstarts]# pwd

/var/lib/cobbler/kickstarts

[root@Jaking kickstarts]# cobbler system add

--name=Jaking-custom

--mac=00:50:56:3E:F0:C6

--profile=CentOS-7.6-x86_64

--ip-address=192.168.1.163

--subnet=255.255.255.0

--gateway=192.168.1.1

--interface=eth0

--static=1

--hostname=Jaking-custom

--name-servers="192.168.1.1"

--kickstart=/var/lib/cobbler/kickstarts/CentOS7.ks

查看 system 列表

[root@Jaking kickstarts]# cobbler system list

Jaking-custom

同步 Cobbler 配置

[root@Jaking kickstarts]# systemctl restart cobblerd

[root@Jaking kickstarts]# cobbler sync

查看 DHCP 配置,发现 DHCP 服务器,已经加入 IP 和 MAC 的对应关系。

[root@Jaking kickstarts]# cat /etc/dhcp/dhcpd.conf

**

Cobbler managed dhcpd.conf file

generated from cobbler dhcp.conf template (Sat Jan 4 10:52:04 2020)

Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes

in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be

overwritten.

**

ddns-update-style interim;

allow booting;

allow bootp;

ignore client-updates;

set vendorclass = option vendor-class-identifier;

option pxe-system-type code 93 = unsigned integer 16;

subnet 192.168.1.0 netmask 255.255.255.0 {

option routers 192.168.1.1;

option domain-name-servers 114.114.114.114;

option subnet-mask 255.255.255.0;

range dynamic-bootp 192.168.1.100 192.168.1.254;

default-lease-time 21600;

max-lease-time 43200;

next-server 192.168.1.7;

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 if option pxe-system-type = 00:09 {

filename "grub/grub-x86_64.efi";

} else {

filename "pxelinux.0";

}

}

}

group for Cobbler DHCP tag: default

group {

host generic1 {

hardware ethernet 00:50:56:3E:F0:C6;

fixed-address 192.168.1.163;

option host-name "Jaking-custom";

option subnet-mask 255.255.255.0;

option routers 192.168.1.1;

filename "/pxelinux.0";

next-server 192.168.1.7;

}

}

多了以上自定义配置

开机,自动安装指定系统

实战-使用 Cobbler 定制化安装指定系统实战-使用 Cobbler 定制化安装指定系统

实战-使用 Cobbler 定制化安装指定系统实战-使用 Cobbler 定制化安装指定系统

直接安装无需等待,并且已经预先设置网络相关参数。

输入 root 123456(服务端定义好的密码) 登录系统:

实战-使用 Cobbler 定制化安装指定系统实战-使用 Cobbler 定制化安装指定系统

MAC 地址为 00:50:56:3E:F0:C6 的系统获取到了指定的 IP 192.168.1.163

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值