經過Cobbler 能夠用來快速創建 Linux 網絡安裝環境。html
1、安裝cobbler軟件python
網絡環境及安裝計劃linux
網關服務器:硬件路由,192.168.88.2web
域名服務器:dnsmasq程序,192.168.88.253shell
DHCP服務器:dnsmasq 程序,192.168.88.253 動態地址範圍192.168.88.100-254 apache
tFTP服務器:tfpd-hpa程序,192.168.88.253安全
cobbler服務器:192.168.88.253服務器
1. 安裝cobbler和cobbler-web網絡
其中cobbler-web,是cobbler的web接口,能夠經過它來使cobbler操做形象。app
# 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界面