cobbler批量部署客户机
- cobbler介绍
- 服务端部署
- 客户端
1.cobbler介绍
2.服务端部署
搭建YUM源:
[root@localhost yum.repos.d]#wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@localhost yum.repos.d]# sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@localhost yum.repos.d]# sed -i 's/^enabled=.*/enabled=1/g' /etc/yum.repos.d/CentOS7-Base-163.repo
安装cobbler以及相关软件:
[root@localhost yum.repos.d]# yum -y install httpd dhcp tftp python-ctypes cobbler xinetd cobbler-web pykickstart
启动服务并设置开机自启:
[root@localhost yum.repos.d]# systemctl start httpd cobblerd;systemctl enable httpd cobblerd
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
ln -s '/usr/lib/systemd/system/cobblerd.service' '/etc/systemd/system/multi-user.target.wants/cobblerd.service'
[root@localhost yum.repos.d]#
修改配置文件
[root@localhost ~]# vim /etc/cobbler/settings
next_server: 192.168.100.200 //改成本地IP
server: 192.168.100.200 //改成本地IP
manage_dhcp: 1 开启DHCP
开启FTP
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,表示开启ftp
per_source = 11
cps = 100 2
flags = IPv4
[root@localhost ~]# systemctl start tftp
[root@localhost ~]# systemctl enable tftp
下载缺失文件:
[root@localhost ~]# cobbler get-loaders
task started: 2020-01-05_231204_get_loaders
task started (id=Download Bootloader Content, time=Sun Jan 5 23:12:04 2020)
path /var/lib/cobbler/loaders/README already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/COPYING.elilo already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/COPYING.yaboot already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/COPYING.syslinux already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/elilo-ia64.efi already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/yaboot already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/pxelinux.0 already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/menu.c32 already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/grub-x86.efi already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/grub-x86_64.efi already exists, not overwriting existing content, use --force if you wish to update
*** TASK COMPLETE *** //表示成功
启动rsync服务并设置开机自启:
[root@localhost ~]# systemctl start rsyncd;systemctl enable rsyncd
生成加密密码:
[root@localhost ~]# openssl passwd -1 -salt "$RANDOM" 'peiyf'
$1$31583$SIsNm8gXL4fTPm5cmYdT90 //将加密后的密码复制到配置文件里
[root@localhost ~]# vim /etc/cobbler/settings
101 default_password_crypted: "$1$31583$SIsNm8gXL4fTPm5cmYdT90"
[root@localhost ~]# systemctl restart cobblerd //重启cobbler服务
[root@localhost ~]# netstat -ntpl //查看读物端口
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:47867 0.0.0.0:* LISTEN 1201/rpc.statd
tcp 0 0 127.0.0.1:25151 0.0.0.0:*