通过Cobbler 可以用来快速建立 Linux 网络安装环境。
一、安装cobbler软件
网络环境及安装计划
网关服务器:硬件路由,192.168.88.2
域名服务器:dnsmasq程序,192.168.88.253
DHCP服务器:dnsmasq 程序,192.168.88.253 动态地址范围192.168.88.100-254
tFTP服务器:tfpd-hpa程序,192.168.88.253
cobbler服务器:192.168.88.253
1. 安装cobbler和cobbler-web
其中cobbler-web,是cobbler的web接口,可以通过它来使cobbler操作形象。
# sudo apt-get install cobbler cobbler-web
建议把debmirror 和createrepo也一并安装好了。其中debmirror是用来建立Debinan系统镜像源的工具,而createrepo是用来建立RedHat系列镜像源的工具。
安装完成后,cobbler和apache的服务都会启动。
2. 检查安装cobbler结果
在这里我用curl小工具来测试
# curl -I 192.168.88.253/cobbler/
HTTP/1.1 200 OK
Date: Fri, 01 Nov 2013 19:24:07 GMT
Server: Apache/2.2.22 (Ubuntu)
Vary: Accept-Encoding
Content-Type: text/html;charset=UTF-8
返回200OK就说明工作正常了。
3. 初步配置cobbler
3.1 检查配置是否正确
运行cobbler check检查配置
# sudo cobbler check
The following are potential configuration items that you may want to fix:
1 : debmirror package is not installed, it will be required to manage debian deployments and repositories
Restart cobblerd and then run 'cobbler sync' to apply changes.
根据上面的提示修复错误。
# sudo apt-get install debmirror
同时配置debmirror
生成/etc/debmirror.conf配置文件
# cp /usr/share/doc/debmirror/examples/debmirror.conf /etc/
修改/etc/debmirror.conf配置文件
注释掉@dists和@arches两行
# vi /etc/debmirror.conf
...
#@dists="sid";
@sections="main,main/debian-installer,contrib,non-free";
#@arches="i386";
...
使配置生效
# sudo cobbler sync
task started: 2013-11-02_033214_sync
task started (id=Sync, time=Sat Nov 2 03:32:14 2013)
running pre-sync triggers
cleaning trees
mkdir: /var/lib/tftpboot/pxelinux.cfg
mkdir: /var/lib/tftpboot/grub
mkdir: /var/lib/tftpboot/images
mkdir: /var/lib/tftpboot/s390x
mkdir: /var/www/cobbler/rendered
mkdir: /var/lib/tftpboot/ppc
mkdir: /var/lib/tftpboot/etc
removing: /var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink /usr/lib/syslinux/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
trying hardlink /usr/lib/syslinux/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /usr/lib/syslinux/chain.c32 -> /var/lib/tftpboot/chain.c32
trying hardlink /boot/memtest86+_multiboot.bin -> /var/lib/tftpboot/images/memtest86+_multiboot.bin
trying hardlink /boot/memtest86+.bin -> /var/lib/tftpboot/images/memtest86+.bin
trying hardlink /usr/lib/syslinux/memdisk -> /var/lib/tftpboot/memdisk
copying distros to tftpboot
copying images
generating GPXE/PXE configuration files
generating PXE menu structure
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
重新检查配置
# sudo cobbler check
No configuration problems found. All systems go.
4. 配置cobbler web
安装好cobbler web后,默认的访问信息如下,
URL:http://<Chostname>/cobbler_web
用户名:cobbler
密码:cobbler
apache配置文件:/etc/apache2/conf.d/cobbler_web.conf
出于安全考虑,可以通过htdigest命令来修改用户cobbler的密码。
# htdigest /etc/cobbler/users.digest "Cobbler" cobbler
Changing password for user cobbler in realm Cobbler
New password:
Re-type new password:
使配置生效
以后我们也可以随时通过cobbler sync来重新加载配置文件。
# cobbler sync
task started: 2013-11-02_034250_sync
task started (id=Sync, time=Sat Nov 2 03:42:50 2013)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/images/memtest86+_multiboot.bin
removing: /var/lib/tftpboot/images/memtest86+.bin
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /boot/memtest86+_multiboot.bin -> /var/lib/tftpboot/images/memtest86+_multiboot.bin
trying hardlink /boot/memtest86+.bin -> /var/lib/tftpboot/images/memtest86+.bin
copying distros to tftpboot
copying images
generating GPXE/PXE configuration files
generating PXE menu structure
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
cobbler web登录界面
cobbler web界面
本文转自xiaoyuwang 51CTO博客,原文链接:http://blog.51cto.com/wangxiaoyu/1322188,如需转载请自行联系原作者