阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

自动化安装工具Cobbler简易安装配置

237次阅读
没有评论

共计 4766 个字符,预计需要花费 12 分钟才能阅读完成。

Cobbler 的安装方式和传统的方式相差无几,但是相对配置简单,提供 WEB 界面,不过相对运维工程师来讲,这个 WEB 反而不太实用。

我个人比较喜欢的是 Cobbler 可以在一套系统内定义多个系统和菜单,在大规模、多样化定制环境中非常实用。

如果只是单纯安装某一个操作系统,批量的,传统的就可以。

实际生产环境为了 DHCP 不冲突,这很重要,由于没有开启 DHCP 中继,所以放在一个新的 VLAN 即可。

实际在应用中,服务器是静态 IP,即便服务器重启并从 PXE 启动也默认从 local 启动,所以影响不大。

Server:192.168.1.110

GATEWAY:192.168.1.253
system:CentOS 6.6 minimal

注:我在 centos6.7 上安装此版本有问题,可能是 BUG。

开始安装:
# 配置 yum 源,使用 epel 安装,基本安装源没有 cobbler
cd /etc/yum.repos.d/
yum install -y epel-release
[root@cobsrv yum.repos.d]# ls
CentOS-Base.repo      CentOS-fasttrack.repo  CentOS-Vault.repo  epel-testing.repo
CentOS-Debuginfo.repo  CentOS-Media.repo      epel.repo

yum clean all

yum install -y cobbler cobbler-web pykickstart debmirror cman fence-agents
  #pykickstart(检查 kickstart 语法错误)

service httpd start
chkconfig httpd on
service cobblerd start

/etc/init.d/iptables stop
chkconfig –level 35 iptables off

[root@cobsrv ~]# getenforce
Enforcing
 vi /etc/selinux/config
#SELINUX=enforcing
SELINUX=disabled

reboot 生效

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 : 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.

#/etc/cobbler/settings 中 next_server 和 server 修改为主机 IP,默认 127.0.0.1
next_server: 192.168.1.110
server: 192.168.1.110

# 修改 default_password_crypted 默认密码,随机生成密码
openssl passwd -1 -salt `openssl rand -hex 4`
Password:
$1$df2d0ac2$F3dFQIzkBge6b7NYivb250
default_password_crypted: “$1$df2d0ac2$F3dFQIzkBge6b7NYivb250”

cobbler get-loaders  #需要联网,没网的话可以从镜像中拿出 pxelinux.0 和 menu.c32 文件
*** TASK COMPLETE ***

ls /var/lib/cobbler/loaders  #最终会 copy 到 /var/lib/tftpboot/images

chkconfig rsync on

vi /etc/debmirror.conf    #注释掉 @dists=”sid” 和 @arches=”i386″
#@dists=”sid”;
@sections=”main,main/debian-installer,contrib,non-free”;
#@arches=”i386″;

cobbler sync    #同步一下数据

vi /etc/cobbler/settings    #manage_dhcp 和 manage_dns 值为 0 表示管理员管理,
值为 1 表示由 cobbler 来管理,默认是 0,修改如下
manage_dhcp: 1
manage_rsync: 1
manage_tftpd: 1

yum -y install dhcp

rpm -q tftp-server
tftp-server-0.49-7.el6.x86_64

cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
vi /etc/dhcp/dhcpd.conf
option domain-name “cobsrv.test”;
option domain-name-servers 219.239.26.42, 124.207.160.106;

subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.100 192.168.1.120;
        option routers 192.168.1.253;
}
next-server 192.168.1.110;
filename=”pxelinux.0″;
# 将原来的 subnet 以 *** 释或者删除

service dhcpd restart
Starting dhcpd:          [OK]

service cobblerd restart

# 插入并挂载光盘,准备生成树,
mount /dev/cdrom /media/ -r
ls /media/    #确认下是否挂载成功

vi /etc/httpd/conf/httpd.conf
ServerName 192.168.1.110:80

service httpd restart

cobbler sync
cobbler check

之前 tftp 没启动
chkconfig tftp on
service xinetd restart

cobbler import –name=”centos-6.6-minimal-x86_64″ –path=/media 
# 复制全部镜像到 /var/www/  时间可能比较长

[root@cobsrv kickstarts]# cd /var/lib/cobbler/kickstarts/
[root@cobsrv kickstarts]# ls
default.ks    esxi5-ks.cfg      legacy.ks    sample_autoyast.xml  sample_esx4.ks 

sample_esxi5.ks  sample_old.seed
esxi4-ks.cfg  install_profiles  pxerescue.ks  sample_end.ks        sample_esxi4.ks  sample.ks     

  sample.seed

cobbler distro list
centos-6.6-minimal-x86_64

cobbler profile add –name=centos-6.6-minimal-x86_64 –distro=rhel-6.4-x86_64 —

kickstart=/var/lib/cobbler/kickstarts/sample.ks

cobbler profile list  #profile 即启动时选择菜单的内容

cobbler sync    #每次改动最好都同步一下,使其生效

vi /var/lib/tftpboot/pxelinux.cfg/default
已经生成菜单

此时启动一台虚机,放在一个网络,选择 PXE 启动可以正常加载了

使用如下 web 地址登陆
http://192.168.1.110/cobbler_web
cobbler/cobbler

我这次使用时在 virtualbox 虚机,选择的是桥接,为了避免无线路由影响,

关闭了无线路由的 DHCP 功能,且 virtualbox 网卡选择 fast III,支持 PXE 启动。

  • CentOS 6.5 安装和配置 Cobbler  http://www.linuxidc.com/Linux/2015-02/113043.htm
  • Cobbler 远程安装 CentOS 系统  http://www.linuxidc.com/Linux/2015-02/113163.htm
  • Cobbler 批量安装 Ubuntu/CentOS 系统  http://www.linuxidc.com/Linux/2015-02/113167.htm

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2015-09/122569.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计4766字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中