实验环境:centos6.0
ip地址:192.168.1.109
这里对于cobbler是做什么的,一些cobbler的相关背景不再赘述,你可以访问谷歌详细了解
程序包准备:
安装cobbler需要配置epel源,参考“
[root@server ~]# cat /etc/yum.repos.d/aliyunepel.repo [epel] name= aliyun epel library baseurl=http://mirrors.aliyun.com/epel/6/x86_64 gpgcheck=0
当然你也可以使用其他的,安装程序包
yum install -y cobber pykickstart debmirror
yum install -y dhcp rsync cman
清楚规则
iptables -F
setenforce 0
设置开机启动的服务:
chkconfig httpd on chkconfig tftp on chkconfig rsync on service xinetd start chkconfig xinetd on
执行cobbler get-loaders
[root@server ~]# cobbler get-loaders task started: 2016-05-05_160957_get_loaders task started (id=Download Bootloader Content, time=Thu May 5 16:09:57 2016) path /var/lib/cobbler/loaders/README already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/COPYING.elilo already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/COPYING.yaboot already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/COPYING.syslinux already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/elilo-ia64.efi already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/yaboot already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/pxelinux.0 already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/menu.c32 already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/grub-x86.efi already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/grub-x86_64.efi already exists, not overwriting existing content, use --force if you wish to update *** TASK COMPLETE ***
开启cobbler的服务,并且设置开机自启
service cobblerd start chkconfig cobblerd on
执行cobbler sync
如果报错,重启cobbler服务,然后执行cobbler get-loaders
开始配置dhcp服务
在/usr/share/doc/dhcp/目录下有一个dhcpd.conf.sample文件,拷贝到/etc/dhcp/dhcpd.conf
覆盖此存在的文件
下面对dhcp的配置文件进行配置,在里面添加一段代码
subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.110 192.168.1.200; #ip地址分配的范围 option routers 192.168.1.1; #网关 next-server 192.168.1.109; #cobbler主机的Ip地址 filename "pxelinux.0"; }
启动dhcp服务
service dhcpd start chkconfig dhcpd start
为cobbler添加镜像文件并且挂载到一个目录上
[root@server ~]# df 文件系统 1K-块 已用 可用 已用% 挂载点 /dev/sda2 30237648 7766632 20935016 28% / tmpfs 381944 0 381944 0% /dev/shm /dev/sda1 495844 30600 439644 7% /boot /dev/sda3 20158332 181612 18952720 1% /home /dev/sr0 4363088 4363088 0 100% /iso
然后执行(时间较长,耐心等待)
cobbler import --name=Centos 6.5 --path=/iso --kickstart=/root/anaconda-ks.cfg
查看结果
cobbler distro list
创建一个新的虚拟机,桥接,开启虚拟机等待自动进入:
结束了
《过程中可能会出现很多的问题,因此需要自己不断的总结和查找资料》