亲宝软件园·资讯

展开

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

人气:0

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 -y install cobbler
[root@60sec /]# service httpd start
Starting httpd:                                            [  OK  ]
[root@60sec /]# service cobblerd start
Starting cobbler daemon:                                   [  OK  ]
2、执行cobbler check命令检查存的问题,而后逐一按提示解决之
 

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

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

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

3、安装dhcp服务
[root@60sec /]# yum -y install 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 domain-name "60sec.com";
option domain-name-servers 192.168.83.137;

default-lease-time 43300;
max-lease-time 86500;
subnet 192.168.83.0 netmask 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="pxelinux.0";
[root@60sec /]# service dhcpd start
Starting dhcpd:                                            [  OK  ]

4、开启tftp服务
[root@60sec /]# chkconfig tftp on
[root@60sec /]# service xinetd start
Starting xinetd:                                           [  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/pxelinux.cfg/default

8、重新创建虚拟机测试

加载全部内容

相关教程
猜你喜欢
用户评论