cobbler批量部署(centos5-7)

Cobbler is an install server; batteries are included
Cobbler is a Linux installation server that allows for rapid setup of network installation environments.
It glues together and automates many associated Linux tasks so you do not have to hop between lots of 
various commands and applications when rolling out new systems, and, in some cases, changing existing ones.
With a simple series of commands, network installs can be configured for PXE, reinstallations, 
media-based net-installs, and virtualized installs (supporting Xen, qemu, KVM, and some variants of VMware). 
Cobbler uses a helper program called koan (which interacts with Cobbler) for reinstallation and virtualization support.   
Cobbler is a small and lightweight application (about 15k lines of Python code). It tries to be extremely 
simple to use both for very small and very large installations -- as well as easy to work on, extend, and hack. 
It avoids being "enterprisey" (as in complicated) whenever possible, but is highly useful in all sorts of 
enterprises by having a lot of advanced features and doing small things to save a large amount of time in repeated tasks.
Cobbler can also optionally help with managing DHCP, DNS, and yum package mirroring infrastructure -- in this regard, 
it is a more generalized automation app, rather than just dealing specifically with installations. 
There is also a lightweight built-in configuration management system, as well as support for integrating 
with configuration management systems like Puppet.  Cobbler has a command line interface, a web interface
and also several API access options.  That sounds like a lot, but it is really pretty simple. 
New users may like to start with the web app after doing the initial setup steps on the command line 
(cobbler check; cobbler import) as it will give them a good idea of all of the features available.
Advanced features do not have to be understood all at once, they can be incorporated over time as the need for them arises.

一、基础环境
1、角色、ip、版本、内核
serverA 192.168.1.30 3.10.0-229.el7.x86_64 CentOS Linux release 7.1.1503 (Core) cobbler dnsmasq httpd tftp-server
cobbler-2.6.9-1
dnsmasq-2.66-14
httpd-2.4.6-31
tftp-server-5.2-11
CentOS-5.9-x86_64-bin-DVD-1of1.iso
CentOS-5.9-x86_64-bin-DVD-2of2.iso
CentOS-6.7-x86_64-bin-DVD1.iso
CentOS-6.7-x86_64-bin-DVD2.iso
CentOS-7-x86_64-Everything-1503-01.iso

2、关闭防火墙和selinux
1)查看到当前已经关闭防火墙了
systemctl status firewalld.service
firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
   Active: inactive (dead)
2)查看到selinux还开着
getenforce 
Enforcing
3)关闭selinux
sed -i ‘s/SELINUX=.*/SELINUX=disabled/‘ /etc/selinux/config
setenforce 0

二、安装cobbler(serverA)
1、安装所需要的包
yum -y install cobbler pykickstart openssl fence-agents dnsmasq syslinux

2、设置开机启动
1)设置http服务开机启动
systemctl enable httpd.service
ln -s ‘/usr/lib/systemd/system/httpd.service‘ ‘/etc/systemd/system/multi-user.target.wants/httpd.service‘
2)设置dnsmasq服务开机启动
systemctl enable dnsmasq.service
ln -s ‘/usr/lib/systemd/system/dnsmasq.service‘ ‘/etc/systemd/system/multi-user.target.wants/dnsmasq.service‘
3)设置cobblerd服务开机启动
systemctl enable cobblerd.service
ln -s ‘/usr/lib/systemd/system/cobblerd.service‘ ‘/etc/systemd/system/multi-user.target.wants/cobblerd.service‘

3、确认cobbler已经正常启动
1)查看cobbler端口
netstat -tupnl |grep python
tcp        0      0 127.0.0.1:25151         0.0.0.0:*               LISTEN      2033/python2
2)查看cobbler进程
ps -ef |grep cobbler
root       2033      1  0 10:37 ?        00:00:00 /usr/bin/python2 /usr/bin/cobblerd -F

4、执行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 : change ‘disable‘ to ‘no‘ in /etc/xinetd.d/tftp
4 : 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.
5 : file /etc/xinetd.d/rsync does not exist
6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
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
Restart cobblerd and then run ‘cobbler sync‘ to apply changes.

5、解决以上问题
1)备份配置
cp /etc/cobbler/settings /etc/cobbler/settings.bak
2)生成root密码为redhat
openssl passwd -1 -salt ‘root‘ ‘redhat‘
$1$root$M1uN9dLHipbORRwJW/xR3/
3)修改配置
sed -i ‘s/^server:.*/server: 192.168.1.30/‘ /etc/cobbler/settings
sed -i ‘s/^next_server:.*/next_server: 192.168.1.30/‘ /etc/cobbler/settings
sed -i ‘/default_password_crypted/c\default_password_crypted:\ "$1$root$M1uN9dLHipbORRwJW/xR3/"‘ /etc/cobbler/settings
sed -i ‘s/^manage_dhcp:.*/manage_dhcp: 1/‘ /etc/cobbler/settings
sed -i ‘s/^manage_dns:.*/manage_dns: 1/‘ /etc/cobbler/settings
sed -i ‘s/^manage_tftpd:.*/manage_tftpd: 1/‘ /etc/cobbler/settings
sed -i ‘s/^restart_dhcp:.*/restart_dhcp: 1/‘ /etc/cobbler/settings
sed -i ‘s/^restart_dns:.*/restart_dns: 1/‘ /etc/cobbler/settings
sed -i ‘s/^pxe_just_once:.*/pxe_just_once: 1/‘ /etc/cobbler/settings
PS:debmirror包在源里已经去除 第6条可以无视
4)下载pxelinux.0和menu.c32等文件
cobbler get-loaders
task started: 2015-10-10_111702_get_loaders
task started (id=Download Bootloader Content, time=Sat Oct 10 11:17:02 2015)
downloading http://cobbler.github.com/loaders/README to /var/lib/cobbler/loaders/README
downloading http://cobbler.github.com/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading http://cobbler.github.com/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading http://cobbler.github.com/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading http://cobbler.github.com/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading http://cobbler.github.com/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading http://cobbler.github.com/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading http://cobbler.github.com/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading http://cobbler.github.com/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading http://cobbler.github.com/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***
5)创建rsync文件
touch /etc/xinetd.d/rsync
6)修改/etc/cobbler/modules.conf配置文件
1)先备份下配置
cp /etc/cobbler/modules.conf /etc/cobbler/modules.conf.bak
2)开始修改
diff /etc/cobbler/modules.conf /etc/cobbler/modules.conf.bak 
56c56
< module = manage_dnsmasq
---
> module = manage_bind
69c69
< module = manage_dnsmasq
---
> module = manage_isc
7)修改/etc/cobbler/dnsmasq.template配置文件
1)先备份下配置
cp /etc/cobbler/dnsmasq.template /etc/cobbler/dnsmasq.template.bak
2)开始修改
diff /etc/cobbler/dnsmasq.template /etc/cobbler/dnsmasq.template.bak 
11c11
< dhcp-range=192.168.1.31,192.168.1.40
---
> dhcp-range=192.168.1.5,192.168.1.200
8)重启服务cobbler
systemctl restart cobblerd.service
9)使配置生效
cobbler sync
task started: 2015-10-10_113739_sync
task started (id=Sync, time=Sat Oct 10 11:37:39 2015)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying images
generating 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 ***
10)再次检查
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.

6、查看下default文件
cat /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.com
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local
LABEL local
        MENU LABEL (local)
        MENU DEFAULT
        LOCALBOOT -1
MENU end

7、挂载并导入dvd iso
1)挂载第1张dvd
cd /opt && mount -o loop /opt/CentOS-6.7-x86_64-bin-DVD1.iso /mnt
mount: /dev/loop0 is write-protected, mounting read-only
2)导入
cobbler import --arch=x86_64 --path=/mnt --name=centos6.7
task started: 2015-10-10_124327_import
task started (id=Media import, time=Sat Oct 10 12:43:27 2015)
Found a candidate signature: breed=redhat, version=rhel6
Found a matching signature: breed=redhat, version=rhel6
Adding distros from path /var/www/cobbler/ks_mirror/centos6.7-x86_64:
creating new distro: centos6.7-x86_64
trying symlink: /var/www/cobbler/ks_mirror/centos6.7-x86_64 -> /var/www/cobbler/links/centos6.7-x86_64
creating new profile: centos6.7-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/centos6.7-x86_64 for centos6.7-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos6.7-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/centos6.7-x86_64
looking for /var/www/cobbler/ks_mirror/centos6.7-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos6.7-x86_64/repodata
*** TASK COMPLETE ***
3)卸载
umount /mnt
4)挂载第2张dvd
cd /opt && mount -o loop /opt/CentOS-6.7-x86_64-bin-DVD2.iso /mnt
mount: /dev/loop0 is write-protected, mounting read-only
5)将第2张光盘继续复制到镜像里
cp -rf /mnt/Packages/ /var/www/cobbler/ks_mirror/centos6.7-x86_64/
cp: overwrite ?.var/www/cobbler/ks_mirror/centos6.7-x86_64/Packages/TRANS.TBL?. y
6)卸载
umount /mnt

8、查看到已经导入了
cobbler list
distros:
   centos6.7-x86_64
profiles:
   centos6.7-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:

9、再次查看default文件
cat /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.com
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local
LABEL local
        MENU LABEL (local)
        MENU DEFAULT
        LOCALBOOT -1
LABEL centos6.7-x86_64
        kernel /images/centos6.7-x86_64/vmlinuz
        MENU LABEL centos6.7-x86_64
        append initrd=/images/centos6.7-x86_64/initrd.img ksdevice=bootif lang=  kssendmac text  ks=http://192.168.1.30/cblr/svc/op/ks/profile/centos6.7-x86_64
        ipappend 2
MENU end

10、修改kickstart配置文件
1)复制模板
cp /var/lib/cobbler/kickstarts/sample_end.ks /var/lib/cobbler/kickstarts/centos6.7x86_64.cfg
2)具体配置
cat /var/lib/cobbler/kickstarts/centos6.7x86_64.cfg
auth  --useshadow  --enablemd5
bootloader --location=mbr
clearpart --all --initlabel
text
firewall --disabled
firstboot --disable
keyboard us
lang en_US
url --url=$tree
$yum_repo_stanza
$SNIPPET(‘network_config‘)
reboot
rootpw --iscrypted $default_password_crypted
selinux --disabled
skipx
timezone Asia/shanghai
install
zerombr
part /boot --fstype=ext4 --size=200
part swap --fstype=swap --size=2048
part / --fstype=ext4 --size=10000
part /opt --fstype=ext4 --grow --size=1
%pre
$SNIPPET(‘log_ks_pre‘)
$SNIPPET(‘kickstart_start‘)
$SNIPPET(‘pre_install_network_config‘)
$SNIPPET(‘pre_anamon‘)
%end
%packages --nobase
wget
vim
openssh-server
$SNIPPET(‘func_install_if_enabled‘)
%end
%post --nochroot
$SNIPPET(‘log_ks_post_nochroot‘)
%end
%post
$SNIPPET(‘log_ks_post‘)
$yum_config_stanza
$SNIPPET(‘post_install_kernel_options‘)
$SNIPPET(‘post_install_network_config‘)
$SNIPPET(‘func_register_if_enabled‘)
$SNIPPET(‘download_config_files‘)
$SNIPPET(‘koan_environment‘)
$SNIPPET(‘redhat_register‘)
$SNIPPET(‘cobbler_register‘)
$SNIPPET(‘post_anamon‘)
$SNIPPET(‘kickstart_done‘)
%end
3)修改默认的模板为centos模板
cobbler profile edit --name=CentOS6.7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6.7x86_64.cfg
4)查看到现在已经在使用centos6.7x86_64.cfg配置文件了
cobbler profile report
Name                           : CentOS6.7-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos6.7-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/centos6.7x86_64.cfg
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : inherit
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : [‘admin‘]
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : inherit
Red Hat Management Server      : inherit
Repos                          : []
Server Override                : inherit
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm

11、重启全部服务
systemctl restart cobblerd.service
systemctl restart dnsmasq.service
systemctl restart httpd.service
systemctl restart xinetd.service

12、查看进程
root      11120  1.1  6.2 363472 30216 ?        Ss   13:07   0:00 /usr/bin/python2 /usr/bin/cobblerd -F
nobody    11130  0.0  0.2  15524  1296 ?        Ss   13:08   0:00 /usr/sbin/dnsmasq -k
root      11137  0.2  1.1 223420  5608 ?        Ss   13:08   0:00 /usr/sbin/httpd -DFOREGROUND
apache    11138  0.0  1.2 225508  6216 ?        S    13:08   0:00 /usr/sbin/httpd -DFOREGROUND
apache    11139  0.0  1.2 225508  6216 ?        S    13:08   0:00 /usr/sbin/httpd -DFOREGROUND
apache    11140  0.0  1.2 225508  6216 ?        S    13:08   0:00 /usr/sbin/httpd -DFOREGROUND
apache    11141  0.0  1.2 225508  6216 ?        S    13:08   0:00 /usr/sbin/httpd -DFOREGROUND
apache    11142  0.0  1.2 225508  6216 ?        S    13:08   0:00 /usr/sbin/httpd -DFOREGROUND
root      11146  0.0  0.2  29272  1056 ?        Ss   13:08   0:00 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid

13、查看端口是否都开放了(53 67 69 80)
netstat -tupnl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      11130/dnsmasq       
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2443/sshd           
tcp        0      0 127.0.0.1:25151         0.0.0.0:*               LISTEN      11120/python2       
tcp6       0      0 :::80                   :::*                    LISTEN      11137/httpd         
tcp6       0      0 :::53                   :::*                    LISTEN      11130/dnsmasq       
tcp6       0      0 :::22                   :::*                    LISTEN      2443/sshd           
udp        0      0 0.0.0.0:53              0.0.0.0:*                           11130/dnsmasq       
udp        0      0 0.0.0.0:67              0.0.0.0:*                           11130/dnsmasq       
udp        0      0 0.0.0.0:69              0.0.0.0:*                           11146/xinetd        
udp6       0      0 :::53                   :::*                                11130/dnsmasq   

三、测试
1、客户端安装的时候按F12网络引导就OK了,这里选择centos6安装

四、配置安装centos7
1、挂载并导入dvd iso
1)挂载dvd
cd /opt && mount -o loop CentOS-7-x86_64-Everything-1503-01.iso /mnt
mount: /dev/loop0 is write-protected, mounting read-only
2)导入
cobbler import --arch=x86_64 --path=/mnt --name=centos7
task started: 2015-10-10_153201_import
task started (id=Media import, time=Sat Oct 10 15:32:01 2015)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path /var/www/cobbler/ks_mirror/centos7-x86_64:
creating new distro: centos7-x86_64
trying symlink: /var/www/cobbler/ks_mirror/centos7-x86_64 -> /var/www/cobbler/links/centos7-x86_64
creating new profile: centos7-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/centos7-x86_64 for centos7-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos7-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/centos7-x86_64
looking for /var/www/cobbler/ks_mirror/centos7-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos7-x86_64/repodata
*** TASK COMPLETE ***
3)卸载
umount /mnt

2、查看到已经有centos6.7和centos7了
cobbler profile list
   CentOS6.7-x86_64
   centos7-x86_64

3、看到default文件里已经有centos6.7和centos7了
cat /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.com
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local
LABEL local
        MENU LABEL (local)
        MENU DEFAULT
        LOCALBOOT -1
LABEL CentOS6.7-x86_64
        kernel /images/centos6.7-x86_64/vmlinuz
        MENU LABEL CentOS6.7-x86_64
        append initrd=/images/centos6.7-x86_64/initrd.img ksdevice=bootif lang=  kssendmac text  ks=http://192.168.1.30/cblr/svc/op/ks/profile/CentOS6.7-x86_64
        ipappend 2
LABEL centos7-x86_64
        kernel /images/centos7-x86_64/vmlinuz
        MENU LABEL centos7-x86_64
        append initrd=/images/centos7-x86_64/initrd.img ksdevice=bootif lang=  kssendmac text  ks=http://192.168.1.30/cblr/svc/op/ks/profile/centos7-x86_64
        ipappend 2
MENU end

4、可以修改或复制之前的kictstart模板
cp /var/lib/cobbler/kickstarts/centos6.7x86_64.cfg /var/lib/cobbler/kickstarts/centos7x86_64.cfg

5、修改centos7使用centos7x86_64.cfg模板
cobbler profile edit --name=CentOS7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7x86_64.cfg

6、最后看下报告
cobbler profile report
Name                           : CentOS7-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos7-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/centos7x86_64.cfg
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : inherit
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : [‘admin‘]
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : inherit
Red Hat Management Server      : inherit
Repos                          : []
Server Override                : inherit
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm
Name                           : CentOS6.7-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos6.7-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/centos6.7x86_64.cfg
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : inherit
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : [‘admin‘]
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : inherit
Red Hat Management Server      : inherit
Repos                          : []
Server Override                : inherit
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm

7、同步下
cobbler sync
task started: 2015-10-10_163555_sync
task started (id=Sync, time=Sat Oct 10 16:35:55 2015)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/centos6.7-x86_64
removing: /var/www/cobbler/images/centos7-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/images/centos6.7-x86_64
removing: /var/lib/tftpboot/images/centos7-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying files for distro: centos7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos7-x86_64/initrd.img
copying files for distro: centos6.7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos6.7-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos6.7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos6.7-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos6.7-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: centos7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos7-x86_64/initrd.img
Writing template files for centos7-x86_64
copying files for distro: centos6.7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos6.7-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos6.7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos6.7-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos6.7-x86_64/initrd.img
Writing template files for centos6.7-x86_64
rendering DHCP files
rendering DNS files
rendering TFTPD files
generating /etc/xinetd.d/tftp
processing boot_files for distro: centos7-x86_64
processing boot_files for distro: centos6.7-x86_64
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: service dnsmasq restart
received on stdout: 
received on stderr: Redirecting to /bin/systemctl restart  dnsmasq.service
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 ***

五、继续测试
1、客户端安装的时候按F12网络引导就OK了,这里选择centos7安装

六、同理安装centos5

时间: 2024-10-13 00:46:37

cobbler批量部署(centos5-7)的相关文章

cobbler批量部署CentOS5和CentOS6

cobbler原理知识介绍 distribution:指定发行版本,pxe只能为一个发行版提供一个安装场景(使用kickstart的情况下) 这是cobbler的最核心组件 定义distribution是为指明某个发行版的内核(kernel)和ramdisk文件(initrd),从而确定是哪个版本,安装启动之后,能找到后面的仓库repository,下载后面要完成安装的各个组件 通过distribution和repository定义profile,指明系统的版本,指定安装需要的包的URL,然后,

自动化运维——CentOS7下利用Cobbler批量部署CentOS

Cobbler是一个使用Python开发的开源项目,通过将部署系统所涉及的所有服务集中在一起,来提供一个全自动批量快速建立Linux系统的网络安装环境,Cobbler最初支持Fedora.RedHat和衍生版(如CentOS和Scientific Linux),现在还支持Debian.Ubuntu.SuSE以及FreeBSD.ESXI等.Cobbler是一款快速的网络系统部署工具,其最大的特点是集合了所有系统部署所需服务,如DHCP.DNS.TFTP,这样你在部署一台操作系统的时候不需要在各个服

自动化运维(一):Cobbler批量部署操作系统

作者:独笔孤行@TaoCloud 前言 Cobbler是自动化运维的必备工具,可通过网络启动(PXE)方式实现操作系统快速批量安装.Cobbler快速安装操作系统基于kickstart实现,但Cobbler功能更完善,管理更加简便.高效.Cobbler通过将安装系统所涉及的服务(tftp.dhcp.kickstart)集中管理,提供全自动化批量快速安装系统的网络环境,以实现大规模机房设备的统一管理. 一.简介 Cobbler支持CLI与WEB两种管理方式.要求所有被安装系统的服务器与Cobble

使用Cobbler批量部署Linux操作系统

下面是具体的配置过程. 默认的rhel6光盘中没有cobbler软件,必须在yum仓库中设置第三方的软件源,才能安装cobbler等软件.这里用的epel软件源,在yum仓库的配置文件中加入以下语句即可: 完成之后,清空yum数据库,然后在重建yum数据库即可. cobbler官方网站:https://fedorahosted.org/cobbler 1.软件的安装: cobbler依赖dns,dhcp,tftp以及httpd,所以这些软件一定要安装.安装完成后,启动上述服务. 2.检查系统是否

Linux服务之cobbler批量部署篇

一.Cobbler简介:Cobbler通过将设置和管理一个安装服务器所涉及的任务集中在一起,从而简化了系统配置.相当于Cobbler封装了DHCP.TFTP.XINTED等服务,结合了PXE.kickstart等安装方法,可以实现自动化安装操作系统,并且可以同时提供多种版本,以实现在线安装不同版本的系统. 1.1 cobbler相关服务DHCP:DHCP(Dynamic Host Configuration Protocol,动态主机配置协议)是一个局域网的网络协议,使用UDP协议工作, 主要有

详解使用Cobbler快速批量部署linux系统

前言:这几天闲着没事来系统组玩玩,学点东西总是好的嘛.系统组系统组当然还是从学会装系统开始.花了两个小时折腾了一下用cobbler批量部署linux系统.第一次做当然中间遇到很多问题,不过都顺利解决了.完了总结一下写个帖子和大家分享一下. 系统版本:Centos6.5 32位cobbler服务器IP:192.168.175.130 IP地址段:192.168.175.120-192.168.175.140子网掩码:255.255.255.0网关:192.168.175.2DNS:8.8.8.8

基于Cobbler实现多版本系统批量部署

前言 运维自动化在生产环境中占据着举足轻重的地位,尤其是面对几百台,几千台甚至几万台的服务器时,仅仅是安装操作系统,如果不通过自动化来完成,根本是不可想象的.记得前面我们探究了基于PXE实现系统全自动安装,但PXE同时只能提供单一操作系统的批量部署,面对生产环境中不同服务器的需求,该如何实现批量部署多版本的操作系统呢?Cobbler便可以的满足这一实际需求,本文带来的是基于Cobbler实现多版本操作系统批量部署. Cobbler 简介 Cobbler是一款自动化操作系统部署的实现工具,由Pyt

centos7使用cobbler(2.8)批量部署

一.    批量部署操作系统的前提 要想批量部署操作系统,得具备以下条件: 客户机支持pxe网络引导 服务器端和客户端建立网络通信(DHCP) 服务器端要有可供客户机开机引导的引导文件 服务器端的可引导文件还必须能传递到客户机(TFTP) 客户机无人值守安装包括安装定制的软件或服务(KICKSTART文件) 1.    认识一下PXE 预启动执行环境(Preboot eXecution Environment,PXE,也被称为预执行环境)提供了一种使用网络接口(Network Interface

cobbler自动批量部署centOS6和centOS7

cobbler简介 使用PXE批量部署时,有一个缺陷,即只能安装单一的操作系统(同一个版本,仅用一个kickstart文件).但是在实际环境中,不同功能的服务器需要部署不同的环境,而cobbler正好满足了这一需求.cobbler基于python开发,是对PXE的二次封装,且提供了CLI和Web的管理形式,使得操作和管理更加简便.cobbler的实现与PXE类似,也需要tftp,httpd,dhcp这些服务.使用yum即可完成cobbler的安装,在安装的同时也会自动安装tftp和httpd服务