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




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

2022-07-20 20:29:24 网络知识 官方管理员

cobbler的简介

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

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


1、安装cobbler

提前配置好epel源http://mirrors.ustc.edu.cn/fedora/epel/6/i386/
[root@60sec/]#yum-yinstallcobbler
[root@60sec/]#servicehttpdstart
Startinghttpd:[OK]
[root@60sec/]#servicecobblerdstart
Startingcobblerdaemon:[OK]
2、执行cobblercheck命令检查存的问题,而后逐一按提示解决之

linux,运维自动化,Cobbler

[root@60sec/]#vim/etc/cobbler/settings
next_server:192.168.83.137
server:192.168.83.137
manage_tftpd:0
[root@60sec/]#yum-yinstallsyslinux
[root@60sec/]#chkconfigrsyncon
[root@60sec/]#yum-yinstallpykickstart

[root@60sec/]#opensslpasswd-1-s alt'opensslrand-hex4'
Password:
$1$openssl$.oduSwbhLj6jqAwVsLo/H1
[root@60sec/]#vim/etc/cobbler/settings
default_password_crypted:"penssl$.oduSwbhLj6jqAwVsLo/H1"

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

3、安装dhcp服务
[root@60sec/]#yum-yinstalldhcp
[root@60sec/]#cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf
[root@60sec/]#vim/etc/dhcp/dhcpd.conf
optiondomain-name"60sec.com";
optiondomain-name-servers192.168.83.137;

default-lease-time43300;
max-lease-time86500;
subnet192.168.83.0netmask255.255.255.0{
range192.168.83.50192.168.83.100;
optionrouters192.168.83.137;
}
next-server192.168.83.137;
filename="pxelinux.0";
[root@60sec/]#servicedhcpdstart
Startingdhcpd:[OK]

4、开启tftp服务
[root@60sec/]#chkconfigtftpon
[root@60sec/]#servicexinetdstart
Startingxinetd:[OK]
5、定义distro,挂载光盘并导入
[root@60sec/]#mount-r/dev/cdrom/media/
[root@60sec/]#cobblerimport--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@60secmnt]#ksvalidatorcentos6.x86_64.cfg

7、设置profile,profile可以理解为按安装需求进行分类。
[root@60secmnt]#cobblerprofileadd--name=CenTos-6.5-x86_64-basic--distro=centos-6.5-x86_64--kickstart=/mnt/centos6.x86_64.cfg
[root@60secmnt]#cobblerprofilelist
CenTos-6.5-x86_64-basic
Centos-6.5-x86_64
[root@60secmnt]#cobblersync
[root@60secmnt]#servicecobblerdrestart
可修改相关信息
[root@60secmnt]#vim/var/lib/tftpboot/pxelinux.cfg/default

8、重新创建虚拟机测试

linux,运维自动化,Cobbler

linux,运维自动化,Cobbler


发表评论:

最近发表
网站分类
标签列表