测试中发现,无法导入32位系统镜像,使用32位的CentOS安装Cobbler也不行,目前未解决。
001 | # 安装环境 |
002 | # cat /etc/redhat-release |
003 | CentOS Linux release 7.1.1503 (Core) |
004 |
005 | # uname -a |
006 | Linux localhost.localdomain 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux |
007 |
008 |
009 | # cat /etc/redhat-release |
010 | CentOS Linux release 7.1.1503 (Core) |
011 | [root@localhost ~] # uname -a |
012 | Linux localhost.localdomain 3.10.0-229.20.1.el7.x86_64 #1 SMP Tue Nov 3 19:10:07 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux |
013 |
014 | # rpm -qa cobbler |
015 | cobbler-2.6.10-1.el7.noarch |
016 |
017 | #################################################################################### |
018 | # |
019 | #安装过程 |
020 | # |
021 | #################################################################################### |
022 | # 增加repo源 |
023 | rpm -ivh http: //mirrors .aliyun.com /epel/epel-release-latest-7 .noarch.rpm |
024 | # 或 |
025 | wget -O /etc/yum .repos.d /epel .repo http: //mirrors .aliyun.com /repo/epel-7 .repo |
026 |
027 | # 安装Cobbler及相关软件 |
028 | yum -y install httpd xinetd tftp-server dnsmasq rsync syslinux |
029 | yum -y install cobbler fence-agents pykickstart |
030 |
031 | # 关闭selinux |
032 | # vi /etc/selinux/config |
033 | SELINUX=disabled |
034 |
035 | # 获取selinux状态 |
036 | # getenforce |
037 |
038 | # 关闭iptables |
039 | systemctl stop firewalld |
040 | systemctl disable firewalld |
041 |
042 | # 生成系统安装后,root的密码 (默认密码为 cobbler) |
043 | # 格式 openssl passwd -1 -salt 'random-phrase-here' 'your-password-here' |
044 | # 其中 random-phrase-here 为干扰码 |
045 |
046 | # openssl passwd -1 -salt 'allgo' 'allgo.cc' |
047 | $1$allgo$sjkKoGvJXV2AuBNFeHyxP. |
048 |
049 | # 修改Cobbler配置/etc/cobbler/settings |
050 | manage_dhcp:1 |
051 | manage_dns:1 |
052 | manage_tftpd:1 |
053 | restart_dhcp:1 |
054 | restart_dns:1 |
055 | next_server:<服务器的 IP 地址> |
056 | server:<服务器的 IP 地址> |
057 | default_password_crypted: "$1$allgo$sjkKoGvJXV2AuBNFeHyxP." |
058 |
059 | # 修改 modules,使用dnsmasq作为DHCP、DNS服务器 |
060 | # vi /etc/cobbler/modules.conf |
061 | [dns] |
062 | module = manage_dnsmasq |
063 |
064 | [dhcp] |
065 | module = manage_dnsmasq |
066 |
067 | [tftpd] |
068 | module = manage_in_tftpd |
069 |
070 | # 修改dnsmasq配置文件 /etc/dnsmasq.conf |
071 | # vi /etc/dnsmasq.conf |
072 |
073 | # Cobbler generated configuration file for dnsmasq |
074 | # $date |
075 | # |
076 |
077 | # resolve.conf .. ? |
078 | #no-poll |
079 | #enable-dbus |
080 | read -ethers |
081 | addn-hosts = /var/lib/cobbler/cobbler_hosts |
082 |
083 | dhcp-range=192.168.211.10,192.168.211.29,255.255.255.0 |
084 | dhcp-ignore=tag:!known |
085 | dhcp-option=3,$next_server |
086 | dhcp-lease-max=1000 |
087 | dhcp-authoritative |
088 | dhcp-boot=pxelinux.0 |
089 | dhcp-boot=net:normalarch,pxelinux.0 |
090 | dhcp-boot=net:ia64,$elilo |
091 |
092 | $insert_cobbler_system_definitions |
093 |
094 | # TFTP配置 |
095 | # cat /etc/xinetd.d/tftp |
096 | # default: off |
097 | # description: The tftp server serves files using the trivial file transfer \ |
098 | # protocol. The tftp protocol is often used to boot diskless \ |
099 | # workstations, download configuration files to network-aware printers, \ |
100 | # and to start the installation process for some operating systems. |
101 | service tftp |
102 | { |
103 | socket_type = dgram |
104 | protocol = udp |
105 | wait = yes |
106 | user = root |
107 | server = /usr/sbin/in .tftpd |
108 | server_args = -s /var/lib/tftpboot |
109 | disable = no |
110 | per_source = 11 |
111 | cps = 100 2 |
112 | flags = IPv4 |
113 | } |
114 |
115 | systemctl start xinetd.service |
116 | systemctl status xinetd.service |
117 | systemctl enable xinetd.service |
118 |
119 | systemctl start tftp.socket |
120 | systemctl status tftp.socket |
121 | systemctl enable tftp.socket |
122 |
123 | systemctl start tftp.service |
124 | systemctl status tftp.service |
125 | systemctl enable tftp.service |
126 |
127 | # 配置httpd |
128 | cd /etc/httpd/conf .d/ |
129 | #移除并备份conf文件,目的不显示测试页面 |
130 | mv autoindex.conf autoindex.conf.bak |
131 | mv userdir.conf userdir.conf.bak |
132 | mv welcome.conf welcome.conf.bak |
133 |
134 |
135 | # 启动httpd、Cobbler |
136 | systemctl start httpd.service |
137 | systemctl enable httpd.service |
138 | systemctl status httpd.service |
139 |
140 | systemctl start cobblerd.service |
141 | systemctl enable cobblerd.service |
142 | systemctl status cobblerd.service |
143 |
144 | # Cobbler检查,会检测到一些错误,根据提示解决 |
145 | cobbler check |
146 |
147 | # Cobbler配置应用 |
148 | cobbler sync |
149 |
150 | # 查看相关应用是否启动 |
151 | ss -naltu |
152 |
153 |
154 | # 准备安装文件 |
155 | # 导入iso文件 |
156 | mount -t iso9660 -o loop,ro /os/CentOS-7-x86_64-Minimal-1503-01 .iso /mnt |
157 | cobbler import --name=centos7mini --path= /mnt --arch=x86_64 |
158 | # cobbler import --arch=x86_64 --path=/mnt --name=centos7mini2 |
159 |
160 | # 查看导入结果 |
161 | cobbler distro list |
162 | cobbler distro report |
163 | cobbler profile report |
164 |
165 | # 添加kickstart配置文件 |
166 | # 从现有sample_end 修改得到 |
167 | # cp /var/lib/cobbler/kickstarts/sample_end.ks /var/lib/cobbler/kickstarts/jxl_data.ks |
168 | # vi /var/lib/cobbler/kickstarts/jxl_data.ks |
169 | timezone Asia /Shanghai --isUtc |
170 | lang en_US.UTF-8 --addsupport=zh_CN.UTF-8 |
171 |
172 | # 添加账号 |
173 | # user --name=<username> [--groups=<list>] [--homedir=<homedir>] [--password=<password>] [--iscrypted] [--shell=<shell>] [--uid=<uid>] |
174 | user --name= "centos" --iscrypted= "$1$juxinli$PEn5Sl/DCkrLOGeSmVrFP1" --uid=1000 |
175 |
176 |
177 | # Allow anaconda to partition the system as needed |
178 | # autopart |
179 |
180 | # Partition clearing information |
181 | clearpart --all --initlabel |
182 | # Disk partitioning information |
183 | part / --asprimary --fstype= "xfs" --size=204800 |
184 | part /boot --asprimary --fstype= "xfs" --size=1024 |
185 | part swap --asprimary --fstype= "swap" --size=4096 |
186 | # kvm |
187 | part /vm --asprimary --fstype= "xfs" --grow --size=1 |
188 | # data |
189 | part /data --asprimary --fstype= "xfs" --grow --size=1 |
190 |
191 | #LVM-data |
192 | part /boot --fstype= "xfs" --size=1024 |
193 | part swap --fstype= "swap" --size=4096 |
194 | part pv.01 --size=1 --grow |
195 | volgroup centos pv.01 |
196 | logvol / --fstype= "xfs" --vgname=centos --size=2048 --name=root |
197 | logvol /data --fstype= "xfs" --vgname=centos --size=1 --grow --name=data |
198 |
199 |
200 | #LVM-kvm |
201 | part /boot --fstype= "xfs" --size=1024 |
202 | part swap --fstype= "swap" --size=4096 |
203 | part pv.01 --size=1 --grow |
204 | volgroup centos pv.01 |
205 | logvol / --fstype= "xfs" --vgname=centos --size=2048 --name=root |
206 | logvol /vm --fstype= "xfs" --vgname=centos --size=1 --grow --name=vm |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 | # cobbler profile add --name=Fedora17-xfce --ksmeta='desktop_pkg_group=@xfce-desktop' --kickstart=/var/lib/cobbler/kickstarts/example.ks --parent=centos7mini2-x86_64 |
215 | # cobbler profile add --name=centos-data --kickstart=/var/lib/cobbler/kickstarts/jxl_data.ks --parent=centos7mini2-x86_64 |
216 |
217 | # 修改kickstart文件 |
218 | cobbler profile edit --name=centos7mini-x86_64 --kickstart= /var/lib/cobbler/kickstarts/jxl_data .ks |
219 |
220 | # 验证kickstart文件内容 |
221 | cobbler profile getks --name=centos7mini-x86_64 |
222 |
223 | # 配置需要安装的机器 |
224 | # 针对MAC为00:0C:29:48:30:63的机器安装 |
225 | cobbler system add --name= test --profile=centos7mini-x86_64 --interface=eno16777736 --mac=00:0C:29:48:30:63 --ip-address=192.168.211.11 --netmask=255.255.255.0 --static=1 --dns-name= test .mydomain.com --gateway=192.168.211.1 -- hostname = test .mydomain.com |
226 |
227 | cobbler system report |
228 |
229 |
230 | ####### |
231 | # 让配置生效 |
232 | cobbler sync |
233 |
234 | #######注意################ |
235 | # 检查 dnsmasq dhcp-range是否正确,因为cobbler sync 会修改 |
236 | grep "range" /etc/dnsmasq .conf |
237 | dhcp-range=192.168.211.10,192.168.211.20 |
238 |
239 | # 修改/etc/dnsmasq.conf 后需要重启dnsmasq |
240 | systemctl restart dnsmasq.service |
241 |
242 |
243 |
244 | ############################## |
245 | # 安装Cobbler Web 界面 |
246 |
247 | yum -y install cobbler-web |
248 | # 修改授权 |
249 | # /etc/cobbler/modules.conf |
250 | [authentication] |
251 | module = authn_pam |
252 |
253 | [authorization] |
254 | module = authz_ownership |
255 |
256 | # 添加Cobbler_web 账号 |
257 | # useradd web && passwd web |
258 |
259 | # 将 账号 添加到Cobbler_web admins组 |
260 | # cat /etc/cobbler/users.conf |
261 | [admins] |
262 | admin = "" |
263 | cobbler = "" |
264 | web = "" |
265 |
266 | # 重启服务 |
267 | service cobblerd restart |
268 | service httpd restart |
269 |
270 | # 登录WEB(注意使用https) |
271 | https: //192 .168.211.131 /cobbler_web/ |
272 |
273 |
274 | # Cobbler 子命令介绍 |
275 | cobbler check #检查cobbler配置 |
276 | cobbler sync #步配置到dhcp pxe和数据目录 |
277 | cobbler list #列出所有的cobbler元素 |
278 | cobbler import #导入安装的系统光盘镜像 |
279 | cobbler report #列出各元素的详细信息 |
280 | cobbler distro #查看导入的发行版系统信息 |
281 | cobbler profile #查看配置信息 |
282 | cobbler system #查看添加的系统信息 |
283 | cobbler reposync #同步yum仓库到本地 |
284 |
285 | cobbler repo add --name=CentOS-7-x86_64 --mirror=http: //mirrors .aliyun.com /centos/7/os/x86_64/ |
286 | cobbler reposync |
287 |
288 |
289 | # 参考文档 |
290 | # Cobbler官网 |
291 | http: //cobbler .github.io /manuals/quickstart/ |
292 | http: //cobbler .github.io /manuals/2 .6.0/ |
293 | # dnsmasq设置 |
294 | http: //debugo .com /dnsmasq/ |
295 | # 使用 Cobbler 自动化和管理系统安装 |
296 | http: //www .ibm.com /developerworks/cn/linux/l-cobbler/ |
297 | # Cobbler自动化工具同时批量部署CentOS7及CentOS6.5 |
298 | http: //www .tuicool.com /articles/YZN3qi |
299 | #kickstart配置文件详解 |
300 | http: //blog .chinaunix.net /uid-17240700-id-2813881 .html |