linux中运维自动化之Cobbler 系统安装使用详解

网络知识 2023-02-09 13:14www.1681989.comseo网站推广

cobbler的简介

cobbler是Redhat支持的一个开源项目,用来部署和安装系统。所以对Redhat系列os支持是比较好的。不过对ubuntu支持是非常差的。cobbler里不少设置,只针对redhat有效,也由于不同发行版的安装是有差异。cobbler感觉好像和ubuntu关系比较紧张.

cobbler不仅仅是一个pxe服务器,他还可以管理dns(bd),dhcp。一般数据中心里或者生产环境,是不允许dhcp,pxe,必须需要dhcp,所以我们需要根据mac地址来分配IP,这样dhcp就不会影响到网络.


1、安装cobbler

提前配置好epel源
[root@60sec /]# yum -y stall cobbler
[root@60sec /]# service httpd start
Startg httpd:                                            [  OK  ]
[root@60sec /]# service cobblerd start
Startg cobbler daemon:                                   [  OK  ]
2、执行cobbler check命令检查存的问题,而后逐一按提示解决之
 

[root@60sec /]# vim /etc/cobbler/settgs
next_server: 192.168.83.137
server: 192.168.83.137
manage_tftpd: 0
[root@60sec /]# yum -y stall syslux
[root@60sec /]# chkconfig rsync on
[root@60sec /]# yum -y stall pykickstart

[root@60sec /]# openssl passwd -1 -salt 'openssl rand -hex 4'
Password:
$1$openssl $.oduSwbhLj6jqAwVsLo/H1
[root@60sec /]# vim /etc/cobbler/settgs
default_password_crypted: "penssl $.oduSwbhLj6jqAwVsLo/H1"

[root@60sec /]# cd /usr/share/syslux/
[root@60sec syslux]# cp -r ./ /var/lib/cobbler/loaders/

3、安装dhcp服务
[root@60sec /]# yum -y stall dhcp
[root@60sec /]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
[root@60sec /]# vim /etc/dhcp/dhcpd.conf
option doma-name "60sec.";
option doma-name-servers 192.168.83.137;

default-lease-time 43300;
max-lease-time 86500;
sub 192.168.83.0 mask 255.255.255.0 {
  range 192.168.83.50 192.168.83.100;
  option routers 192.168.83.137;
}
next-server 192.168.83.137;
filename="pxelux.0";
[root@60sec /]# service dhcpd start
Startg dhcpd:                                            [  OK  ]

4、开启tftp服务
[root@60sec /]# chkconfig tftp on
[root@60sec /]# service xid start
Startg xid:                                           [  OK  ]
5、定义distro,挂载光盘并导入
[root@60sec /]# mount -r /dev/cdrom /media/
[root@60sec /]# cobbler import  --name=centos-6.5-x86_64  --path=/media

6、如果有kickstart文件,使用“--kickstart=/path/to/kickstart_file”进行导入,也可使用以下命令检测,
可以使用system-config-kickstart进行制作kickstart文件。cobbler的ks 文件默认都放在/var/lib/cobbler/kickstarts/下面 可以根据不同的需求定制ks文件。
[root@60sec mnt]# ksvalidator centos6.x86_64.cfg

7、设置profile,profile可以理解为按安装需求进行分类。
[root@60sec mnt]# cobbler profile add --name=CenTos-6.5-x86_64-basic --distro=centos-6.5-x86_64 --kickstart=/mnt/centos6.x86_64.cfg
[root@60sec mnt]# cobbler profile list
   CenTos-6.5-x86_64-basic
   Centos-6.5-x86_64
[root@60sec mnt]# cobbler sync
[root@60sec mnt]# service cobblerd restart
可修改相关信息
[root@60sec mnt]# vim /var/lib/tftpboot/pxelux.cfg/default

8、重新创建虚拟机测试

Copyright © 2016-2025 www.1681989.com 推火网 版权所有 Power by