使用cobbler安装centos6.6(vmware)

本文涉及的产品
全局流量管理 GTM,标准版 1个月
云解析 DNS,旗舰版 1个月
公共DNS(含HTTPDNS解析),每月1000万次HTTP解析
简介:
1
2
3
4
5
6
7
8
9
10
11
12
13
我的博客已迁移到xdoujiang.com请去那边和我交流
一、基础环境
1、关闭selinux服务 
sed  -i  's/SELINUX=.*/SELINUX=disabled/'  /etc/selinux/config
setenforce 0
 
2、关闭iptables服务
chkconfig iptables off
iptables -F
/etc/init .d /iptables  save
/etc/init .d /iptables  stop
 
3、serverA桥接模式

wKioL1WZNaKAtUljAAILXuBa5GU468.jpg

1
4、服务端serverA=192.168.1.120(我这里只使用了eth0网络接口)

wKiom1WZM-vi9bcvAAGVZ-DU4A4692.jpg

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
5、之前已经下载好了2张dvd
CentOS-6.6-x86_64-bin-DVD1.iso和CentOS-6.6-x86_64-bin-DVD2.iso
 
二、安装cobbler(serverA)
1、安装所需要的包
yum -y  install  cobbler debmirror pykickstart openssl fence-agents dnsmasq syslinux
 
2、先看下cobbler命令有哪些
cobbler
usage
=====
cobbler <distro|profile|system|repo|image|mgmtclass|package| file > ... 
         [add|edit|copy|getks*|list|remove|rename|report] [options|--help]
cobbler <aclsetup|buildiso| import |list|replicate|report|reposync| sync |validateks|version|signature|get-loaders|hardlink> [options|--help]
 
3、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)SELinux is enabled. Please review the following wiki page  for  details on ensuring cobbler works correctly  in  your SELinux environment:
     https: //github .com /cobbler/cobbler/wiki/Selinux
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)change  'disable'  to  'no'  in  /etc/xinetd .d /rsync
6)comment out  'dists'  on  /etc/debmirror .conf  for  proper debian support
7)comment out  'arches'  on  /etc/debmirror .conf  for  proper debian support
8)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.
 
4、下载客户端启动文件
cd  /var/lib/cobbler/loaders
cat  filelist.txt
http: //dgoodwin .fedorapeople.org /loaders/README
http: //dgoodwin .fedorapeople.org /loaders/COPYING .elilo
http: //dgoodwin .fedorapeople.org /loaders/COPYING .yaboot
http: //dgoodwin .fedorapeople.org /loaders/COPYING .syslinux 
http: //dgoodwin .fedorapeople.org /loaders/elilo-3 .8-ia64.efi
http: //dgoodwin .fedorapeople.org /loaders/yaboot-1 .3.14-12
http: //dgoodwin .fedorapeople.org /loaders/pxelinux .0-3.61
http: //dgoodwin .fedorapeople.org /loaders/menu .c32-3.61
http: //dgoodwin .fedorapeople.org /loaders/grub-0 .97-x86.efi
http: //dgoodwin .fedorapeople.org /loaders/grub-0 .97-x86_64.efi
wget -i filelist.txt
 
5、修改 /etc/cobbler/settings 配置文件
1)先备份下配置
cp  /etc/cobbler/settings  /etc/cobbler/settings .bak
2)生成密码
openssl  passwd  -1 -salt  'root'  'redhat'
$1$root$M1uN9dLHipbORRwJW /xR3/
3)开始修改
sed  -i  's/^server:.*/server: 192.168.1.120/'  /etc/cobbler/settings
sed  -i  's/^next_server:.*/next_server: 192.168.1.120/'  /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
 
6、修改 /etc/xinetd .d /rsync 配置文件
1)先备份下配置
cp  /etc/xinetd .d /rsync  /etc/xinetd .d /rsync .bak
2)开始修改
sed  -i  '/disable/s/yes/no/g'  /etc/xinetd .d /rsync
 
7、修改 /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
 
8、修改 /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.140,192.168.1.150
---
> dhcp-range=192.168.1.5,192.168.1.200
 
9、修改kickstart配置文件
1)进入目录
cd  /var/lib/cobbler/kickstarts
2)复制模板给centos6.6x86_64.cfg
cp  sample_end.ks centos6.6x86_64.cfg
3)修改默认的模板为centos模板
cobbler profile edit --name=CentOS6.6-x86_64 --kickstart= /var/lib/cobbler/kickstarts/centos6 .6x86_64.cfg
4)具体配置
cat  centos6.6x86_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
 
10、挂载并导入dvd iso
1)挂载第1张dvd
mount  -o loop  /opt/CentOS-6 .6-x86_64-bin-DVD1.iso  /mnt
cobbler  import  --arch=x86_64 --path= /mnt  --name=centos6.6
umount  /mnt
2)挂载第2张dvd
mount  -o loop  /opt/CentOS-6 .6-x86_64-bin-DVD2.iso  /mnt
cp  -rf  /mnt/Packages/  /var/www/cobbler/ks_mirror/centos6 .6-x86_64/
umount  /mnt
 
11、创建索引
1)进入目录
cd  /var/www/cobbler/ks_mirror/centos6 .6-x86_64/
2)createrepo创建索引
createrepo -g repodata /9e2ddcc42b44eb150ebc61dde29c997318d8330b92205b3dbb3a87bcc06d10be-c6-x86_64-comps .xml .
Spawning worker 0 with 6518 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving  file  lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
 
12、设置开机启动
chkconfig httpd on 
chkconfig cobblerd on
chkconfig dnsmasq on
 
13、启动服务
/etc/init .d /cobblerd  restart
/etc/init .d /dnsmasq  restart
service xinetd restart
/etc/init .d /httpd  restart
 
14、同步
cobbler  sync
 
15、查看端口是否都开放了(53 67 69 80 873)
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      1002 /dnsmasq        
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1017 /sshd           
tcp        0      0 127.0.0.1:25151             0.0.0.0:*                   LISTEN      1077 /python2        
tcp        0      0 :::53                       :::*                        LISTEN      1002 /dnsmasq        
tcp        0      0 :::22                       :::*                        LISTEN      1017 /sshd           
tcp        0      0 :::873                      :::*                        LISTEN      1026 /xinetd         
tcp        0      0 :::80                       :::*                        LISTEN      1044 /httpd          
udp        0      0 0.0.0.0:53                  0.0.0.0:*                               1002 /dnsmasq        
udp        0      0 0.0.0.0:67                  0.0.0.0:*                               1002 /dnsmasq        
udp        0      0 0.0.0.0:69                  0.0.0.0:*                               1026 /xinetd         
udp        0      0 :::53                       :::*                                    1002 /dnsmasq   
 
16、通过命令cobbler setting report来查看下之前修改的配置内容
cobbler setting report
 
17、查看
cobbler list
distros:
    centos6.6-x86_64
profiles:
    CentOS6.6-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:
 
18、查看导入的发行版系统信息cobbler distro report
cobbler distro report
Name                           : centos6.6-x86_64
Architecture                   : x86_64
TFTP Boot Files                : {}
Breed                          : redhat
Comment                        : 
Fetchable Files                : {}
Initrd                         :  /var/www/cobbler/ks_mirror/centos6 .6-x86_64 /images/pxeboot/initrd .img
Kernel                         :  /var/www/cobbler/ks_mirror/centos6 .6-x86_64 /images/pxeboot/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : { 'tree' 'http://@@http_server@@/cblr/links/centos6.6-x86_64' }
Management Classes             : []
OS Version                     : rhel6
Owners                         : [ 'admin' ]
Red Hat Management Key         : inherit
Red Hat Management Server      : inherit
Template Files                 : {}
 
19、查看配置信息cobbler profile report
cobbler profile report
Name                           : centos6.6-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos6.6-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart                      :  /var/lib/cobbler/kickstarts/centos6 .6x86_64.cfg
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : inherit
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : [ 'admin' ]
Parent Profile                 : 
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
 
20、查看状态
查看正在安装
cobbler status
ip             |target              |start            |state            
192.168.1.148  |profile:CentOS6.6-x86_64|Sun Jul  5 20:50:36 2015|installing (6m 4s)      
查看已经安装完成
cobbler status
ip             |target              |start            |state            
192.168.1.148  |profile:CentOS6.6-x86_64|Sun Jul  5 20:50:36 2015|finished   
 
21、查看安装好后的信息

wKiom1WZNGPDNK6YAAJ11RezRXo697.jpg

wKioL1WZNi_Sq263AAEMdhzTN1A869.jpg

1
2
三、客户端也是配置的桥接模式,客户端安装的时候按F12网络引导就OK了,
选择相应需要安装的发行版本,回车后就一路安装了.

wKiom1WZNTPwzLsAAABcg4l5YXU831.jpg

wKioL1WZNv6D60CXAAC_ToFRd9Y428.jpg










本文转自 xdoujiang 51CTO博客,原文链接:http://blog.51cto.com/7938217/1671122,如需转载请自行联系原作者
目录
相关文章
|
13天前
|
缓存 Linux 调度
【YashanDB数据库】VMware虚拟机使用默认安装,在掉电之后数据库无法启动
VMware虚拟机使用默认安装,在掉电之后数据库无法启动
|
10天前
|
IDE 测试技术 数据库
【YashanDB知识库】使用vmware虚拟机安装的YashanDB,本机无法访问
在 VMware 虚拟机中安装并测试 YashanDB,数据库及虚拟机运行正常,但本地 IDE 工具无法连接虚拟机中的数据库。问题可能与 VMware 网络适配器配置或网络模式(如 NAT、桥接)有关,导致网络通信异常。需检查虚拟机网络设置、IP 地址配置以及防火墙规则,确保本地与虚拟机间网络连通性。目前无明确修复版本。
|
19天前
|
Linux 虚拟化 数据安全/隐私保护
系统崩溃不用慌!VMware这个逆天功能竟能让CentOS一键回档?后悔药真实存在!
备份的重要性在于它能在系统出现异常或错误时,帮助我们快速恢复到正常状态,避免重新安装系统和配置环境。VMware 提供了两种备份方式:快照和克隆。 **快照**是保存虚拟机某一时刻的完整状态(包括内存、CPU、磁盘数据),便于快速回滚,适合临时保存状态。操作简单,可在系统运行时创建。 **克隆**则是复制整个虚拟机系统,侧重长期备份,需在系统关闭时进行。分为完整克隆和链接克隆,前者独立于源系统,占用更多空间,但更安全可靠。
52 17
系统崩溃不用慌!VMware这个逆天功能竟能让CentOS一键回档?后悔药真实存在!
|
19天前
|
Linux 虚拟化 Windows
VMware隐藏黑科技!CentOS安装这个神器效率翻倍 文件互传竟比U盘还快?
### 安装VMtools的作用及步骤 安装VMtools可以实现Windows与CentOS之间的字符串和命令粘贴、文件夹共享等操作。在CentOS中,通过VMware菜单栏选择“VMware Tools”,将下载的压缩包拷贝到`/opt`目录并解压。接着进入终端,使用`./vmware-install.pl`命令完成安装。安装后重启系统,即可实现Windows与CentOS之间的字符和文件共享。具体步骤包括解压文件、启动命令行终端、安装VMtools以及配置文件共享。
66 16
VMware隐藏黑科技!CentOS安装这个神器效率翻倍 文件互传竟比U盘还快?
|
19天前
|
存储 IDE Linux
零基础保姆级教程!手把手教你免费玩转Linux CentOS安装+学习环境搭建(附避坑指南)
本文详细介绍了在VMware虚拟机中安装CentOS 6.8的全过程。首先,需确保已安装VMware并开启V-CPU虚拟化功能,可通过BIOS设置或使用LeoMoon CPU-V工具检测。接着,下载CentOS镜像文件,并在VMware中新建虚拟机,配置CPU、内存、硬盘等参数。最后,加载ISO镜像启动虚拟机,按照提示完成CentOS的安装,包括语言、键盘、存储方式、地区、密码设置及硬盘分区等步骤。安装完成后,以root用户登录即可进入系统桌面,开始学习Linux命令和操作。
91 12
零基础保姆级教程!手把手教你免费玩转Linux CentOS安装+学习环境搭建(附避坑指南)
|
6天前
|
存储 Linux 网络安全
如何从CentOS7升级到8?CentOS8最新安装教程
从CentOS 7升级到8只需三步:清理系统、更换软件包及存储库、安装新内核与发布版本。首先确保系统最新并清理冗余包,接着替换基础系统包为CentOS 8版本,最后通过DNF工具完成内核更新与系统同步。整个过程需在终端执行,建议升级前备份VPS快照以防数据丢失。此方法可避免重装系统导致的数据清除问题,实现平滑升级。
37 6
|
1月前
|
存储 编解码 虚拟化
【2025最新】VMware Workstation Pro 虚拟机配置与安装VMware Tools 感受它的强大~
VMware Tools 是 VMware 虚拟机中自带的一种增强工具,能够显著提升虚拟机的性能和用户体验。它提供了优化的显卡驱动程序、文件共享与拖放功能、时间同步以及跨虚拟机和宿主机的复制粘贴功能。安装 VMware Tools 可以让虚拟机在 VMware 平台上运行得更加高效,并且对于老旧系统(如 Win98、Win2000、WinXP)也能提供必要的驱动支持。每个虚拟机都需要独立安装与其操作系统版本相匹配的 VMware Tools,以确保最佳兼容性和性能表现。
81 6
【2025最新】VMware Workstation Pro 虚拟机配置与安装VMware Tools 感受它的强大~
|
7天前
|
IDE 测试技术 网络安全
【YashanDB知识库】使用vmware虚拟机安装的YashanDB,本机无法访问
【YashanDB知识库】使用vmware虚拟机安装的YashanDB,本机无法访问
|
1月前
|
Web App开发 安全 Linux
【独家揭秘2025】VMware Workstation Pro虚拟机:免费安装教程大放送,一键解锁操作系统模拟神器!
VMware Workstation Pro 是由威睿(VMware)公司开发的一款功能强大的桌面虚拟化软件,允许用户在同一台物理计算机上同时运行多个操作系统,如Windows、..
77 2
【独家揭秘2025】VMware Workstation Pro虚拟机:免费安装教程大放送,一键解锁操作系统模拟神器!
|
1天前
|
安全 Linux 虚拟化
VMware Tools 12.5.1 下载 - 虚拟机必备组件 (驱动和交互式服务)
虚拟机必备组件 (驱动和交互式服务)
33 13
VMware Tools 12.5.1 下载 - 虚拟机必备组件 (驱动和交互式服务)

热门文章

最新文章