admin 管理员组

文章数量: 887016

CentOS7 部署Cobbler(PXE)实现自动化安装Centos、Windows

1 环境:

系统

CentOS7.5

IP

192.168.100.2

Cobbler是基于PXE的升级版,简化了配置步骤,能同时管理DHCP、TFTP等,还提供了web界面,但是没有记录下来,我大概看了下,web界面还是挺方便的,感兴趣的童鞋可以安装看看

这里用的是CentOS7.5,我用CentOS7.2也是成功了,所以理论上,CentOS7各版本都是可以的

 

2 cobbler部署

2.1 关闭防火墙

# systemctl stop firewalld
# systemctl disable firewalld

 

2.2 关闭selinux

# setenforce 0
# sed -i "s/^SELINUX=.*/SELINUX=permissive/g" /etc/sysconfig/selinux

 

2.3 安装epel源

# yum install -y epel-release

 

2.4 安装cobbler及其相关软件

# yum -y install cobbler dhcp tftp-server pykickstart httpd

 

2.5 修改cobbler配置文件

2.5.1 修改server和next_server参数

# vi /etc/cobbler/settings
将server: 127.0.0.1修改为server: 192.168.100.2
将next_server: 127.0.0.1修改为next_server: 192.168.100.2

这里的192.168.100.2为当前节点IP

 

2.5.2 修改default_password_crypted参数

# openssl passwd -1 -salt 'passwd' '123456'
$1$passwd$h/du.ylwCiLuPa1Br.Ho2.

 

这里的123456设置的是默认密码

将得到的结果替换default_password_crypted的参数

例如:

# vi /etc/cobbler/settings
default_password_crypred: "$1$passwd$h/du.ylwCiLuPa1Br.Ho2."

 

2.5.3 开启管理DHCP

# vi /etc/cobbler/settings

将manage_dhcp参数改为1

将pxe_just_once参数改为1

修改DHCP模板

# vi /etc/cobbler/dhcp.template
subnet 192.168.100.0 netmask 255.255.255.0 {
     option routers             192.168.100.1;
     option domain-name-servers 114.114.114.114;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.100.10 192.168.100.200;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;

 

2.6 启用tftp

将/etc/xinetd.d/tftp的disable选项改为no

# /etc/xinetd.d/tftp
disable = no

 

2.7 启动相关服务

# systemctl start httpd rsyncd tftp cobblerd
# systemctl enable httpd rsyncd tftp cobblerd

 

 

2.8 检查cobbler

#

本文标签: Cobbler PXE Windows centos