1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
|
我的博客已迁移到xdoujiang.com请去那边和我交流
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安装
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
四、配置安装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安装
|
1
|
六、同理安装centos5
|
本文转自 xdoujiang 51CTO博客,原文链接:http://blog.51cto.com/7938217/1701948,如需转载请自行联系原作者