Cobbler是一大Linux装机利器,可以快速的建立网络安装环境。
yum install cobbler
cobbler check
The following are potential configuration items that you may want to fix:
1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
4 : change 'disable' to 'no' in /etc/xinetd.d/rsync
5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
6 : ksvalidator was not found, install pykickstart
7 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
Restart cobblerd and then run 'cobbler sync' to apply changes.
根据上面的提示去修改设置。修改之后要重启cobbler和同步。
注意点:
1:关闭selinux和iptables
[root@fedora17 ~]# sestatus
SELinux status: disabled
[root@fedora17 ~]# systemctl status iptables.service
iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled)
Active: inactive (dead)
CGroup: name=systemd:/system/iptables.servic
2:server和next-server都修改成固定ip地址
# default, localhost
server: 127.0.0.1
# default, localhost
next_server: 127.0.0.1
3:manage_dhcp修改成1,允许dhcp
# default, don't manage
manage_dhcp: 0
4:
修改 /etc/cobbler/dhcp.template
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option domain-name-servers 192.168.1.210,192.168.1.211;
option subnet-mask 255.255.255.0;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
$ systemctl start cobblerd.service
$ systemctl enable cobblerd.service
$ systemctl status cobblerd.service
$ systemctl start httpd.service
$ systemctl enable httpd.service
$ systemctl status httpd.service
$ systemctl start dhcpd.service
$ systemctl enable dhcpd.service
$ systemctl status dhcpd.service
mount -t iso9660 -o loop,ro /path/to/isos/Fedora-17-x86_64-DVD.iso /mnt
cobbler import --name=fedora17 --arch=x86_64 --path=/mnt
(--arch
可以不指定)
task started: 2013-09-01_152920_import
task started (id=Media import, time=Sun Sep 1 15:29:20 2013)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=fedora16
Found a candidate signature: breed=redhat, version=fedora17
Found a matching signature: breed=redhat, version=fedora17
Adding distros from path /var/www/cobbler/ks_mirror/fedora18:
creating new distro: fedora18-x86_64
trying symlink: /var/www/cobbler/ks_mirror/fedora18 -> /var/www/cobbler/links/fedora18-x86_64
creating new profile: fedora18-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/fedora18 for fedora18-x86_64
processing repo at : /var/www/cobbler/ks_mirror/fedora18
need to process repo/comps: /var/www/cobbler/ks_mirror/fedora18
looking for /var/www/cobbler/ks_mirror/fedora18/repodata/*comps*.xml
running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/fedora18/repodata/767f84f69c06ee9b14da2cc3ece4532520bd65969f4d8849852db692bbe57bc3-Fedora-17-comps.xml /var/www/cobbler/ks_mirror/fedora18
received on stdout: Spawning worker 0 with 3349 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
received on stderr:
*** TASK COMPLETE ***
# list distros $ cobbler distro list
fedora17-x86_64
fedora18-x86_64
# list profiles $ cobbler profile list
fedora17-x86_64
fedora18-x86_64
创建一台VM,指定从pxe启动,就可以自动完成安装了。
(a)在客户端安装koan
rpm -ivh koan-2.4.0-1.el6.noarch.rpm
warning: koan-2.4.0-1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY Preparing... ########################################### [100%] 1:koan ########################################### [100%]
(b)查看服务端profile文件
koan --server=172.16.0.67 --list=profiles
- looking for Cobbler at http://172.16.0.67:80/cobbler_api fedora17-x86_64 rhel6.2-i386 centos6.4-x86_64 fedora18-x86_64
(c)执行重新安装
koan --replace-self --server=172.16.0.67 --profile=centos6.4-x86_64
- looking for Cobbler at http://172.16.0.67:80/cobbler_api - reading URL: http://172.16.0.67/cblr/svc/op/ks/profile/centos6.4-x86_64 install_tree: http://172.16.0.67/cblr/links/centos6.4-x86_64 downloading initrd initrd.img to /boot/initrd.img_koan url=http://172.16.0.67/cobbler/images/centos6.4-x86_64/initrd.img - reading URL: http://172.16.0.67/cobbler/images/centos6.4-x86_64/initrd.img downloading kernel vmlinuz to /boot/vmlinuz_koan url=http://172.16.0.67/cobbler/images/centos6.4-x86_64/vmlinuz - reading URL: http://172.16.0.67/cobbler/images/centos6.4-x86_64/vmlinuz - ['/sbin/grubby', '--add-kernel', '/boot/vmlinuz_koan', '--initrd', '/boot/initrd.img_koan', '--args', '"ks=http://172.16.0.67/cblr/svc/op/ks/profile/centos6.4-x86_64 ksdevice=link kssendmac lang= text "', '--copy-default', '--make-default', '--title=kick1378909053'] - reboot to apply changes
reboot之后,系统执行重装操作
参考:
http://www.cobblerd.org/manuals/2.4.0/2_-_Cobbler_Quickstart_Guide.html