Cobbler 安装篇
简要说明:
Cobbler集众家之长支持众多有服务,我在这里简单的说一下Cobbler集成了哪些服务,
- PXE 服务
- DHCP服务管理
- DNS服务管理
- HTTP服务管理
- TFTP服务管理
- Kickstart服务
- yum仓库管理
- 电源管理
--------------------------------------------------------------------------------------------------------------------
安装环境: CentOS 6.5 x86_64 (我的默认是最小化安装的包)
Cobbler 版本: cobbler :2.6.3 cobbler-web: 2.6.3 版本要统一(很重要)
测试环境: 虚拟机环境(Server,Client都是虚拟机)
1. 更新安装源:
#rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
备用: # rpm -Uvh http://ftp.sjtu.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
#安装基础服务组件
#vi /etc/selinux/config
SELINUX=disabled
#chkconfig iptables off
#chkconfig iptables stop
#reboot
------------------------------------------------
#yum -y install dhcp tftp rsync xinetd httpd
#chkconfig dhcpd on
#chkconfig httpd on
#chkconfig xinetd on
# chkconfig xinetd on && chkconfig httpd on && chkconfig dhcpd on && chkconfig ip6tables off && chkconfig iptables off
---------------------------------------------------------------
编辑配置文件:
# vi /etc/httpd/conf/httpd.conf
默认:#ServerName www.example.com:80
改成:ServerName 192.168.77.102:80 //服务器IP地址
#service httpd start
#service xinetd start
-----------------------------------------------------------------
安装Cobbler
#yum -y install cobbler cobbler-web pykickstart debmirror
#yum -y install cman //安装电源管理组件
#rpm -qa | grep cobbler
注意: 版本一定一定要对应,否则各种蛋疼的问题。
我之前的版本:
安装配置出各种问题
-----------------------------------------------------------
修改配置文件:
#vi /etc/cobbler/setting
next_server:127.0.0.1 替换成本机IP: 192.168.75.102
‘manage_dhcp: 0‘ 替换为 1(cobbler管理dhcp,后面用于同步更新配置信息[cobbler sync])
‘manage_rsync: 0‘ 替换为 1 (cobbler管理rsync功能)
#vi /etc/xinetd.d/tftp
修改为: disable=no
#vi /etc/xinetd.d/rsync
修改为: disable=no
-------------------------------------------------------------------------
#cobblerd check
配置DHCP服务
#vi /etc/dhcp/dhcpd.conf
#service dhcpd start
-------------------------------------------------------------------------
如果部署Ubuntu/Debian 则将dists="sid", arches="i386"注释:
配置密码:
#openssl passwd -1 -salt ‘test.com‘ ‘test‘
// -1 是数字1
$1$test.com$tQV/4zLOUiGTo/cq3lpRx/
#vi /etc/cobbler/settings
default_password_crypted: "$1$test.com$tQV/4zLOUiGTo/cq3lpRx/"
#service cobblerd restart
#cobbler check
#vi /etc/cobbler/setting
server: 127.0.0.1 改成:server: 192.168.75.102
#service cobblerd restart
#cobbler get-loaders
#修改cobbler 里的DHCP模板成你服务器所在的网段
#次步骤非常重要,执行cobbler sync同步时会把dhcp.template模板里的配置同步到/etc/dhcpd/dhcpd.conf 。如果网段不对,dhcp服务将无法重启,同步会报错 。
#vi /etc/cobbler/dhcp.template
#cobbler sync
---------------------------------------------------------------------------------------------------------
添加WEB账号密码:
#htdigest /etc/cobbler/users.digest "Cobbler" cobbler //重置已存在的账户密码
#htdigest /etc/cobbler/users.digest "Cobbler" tim
#/etc/cobbler/modules.conf //确认配置
[authentication]
module = authn_configfile
[authorization]
module = authz_allowall
#service cobbler restart
#service httpd restart
http://192.168.75.102/cobbler_web
输入上一步设置:账户和密码
挂载CentOS 安装盘(ISO文件)
#mount /dev/cdrom /media
#cobbler import --name CentOS-OS-6.5 --path=/media
//将光盘内容同步到collber 目录下
#ls /var/www/cobbler/ks_mirror
#cobbler distro list // CentOS-OS-65.
#cobbler sync
--------------------------------------------
查看:
#cobbler list
#cobbler profile
1. 客户端改成网卡引导:
2. 选择CentOS-OS-6.5-X86 _64
3. 开始自动安装
默认安装时cobbler默认的ks安装文件 。
#cobbler report //查看默认使用的ks文件
# cd /var/lib/cobbler/kickstarts/sample_end.ks
如要修改请参考如何修改cobbler ks 文件
----------------------------------------------------------------------------
备注: 日常命令收录:
1.挂载光盘镜像
#mount -o loop /data/software/iso/CentOS-6.3-x86_64-bin-DVD1.iso /media/
2.使用import进行导入
# cobbler import --arch=x86_64 --breed=redhat --os-version=rhel6 --path=/media/ --name=CentOS6.3
3.创建profile,关联distro和kickstart file(可选)
# cobbler profile add --name=CentOS6.3-KVM --distro=CentOS6.3 --kickstart=/var/lib/cobbler/kickstarts/ks_centos6.3_kvm.cfg
-----------------------------------------------------------------------
报错问题:
1. httpd 未启动,同步报错:
解决方法:
#service httpd restart
#serivce cobblerd restart
#cobbler sync
成功执行同步
2.报错问题2:
#service cobblerd restart
#cobbler sync 执行后报错:
解决方法: vi /etc/cobbler/dhcp.template
#service cobblerd restart
#cobbler sync 执行成功
查看/etc/dhcp/dhcpd.conf 内容是否跟/etc/cobbler/dhcp.template 网段内容是否相同。