cobbler [epel]
cobbler服务集成
PXE
DHCP
rsync
Http
DNS
Kickstart
IPMI[电源管理]
1.软件安装
yum install cobbler dhcp; rpm -ql cobbler
systemctl enable cobblerd dhcpd tftp httpd
systemctl start cobblerd tftp httpd
2.检查配置信息
cobbler check;#以下4种提示信息根据实际情况可选择忽略
1 : enable and start rsyncd.service with systemctl
2 : debmirror package is not installed, it will be required to manage debian deployments and repositories
3 : ksvalidator was not found, install pykickstart
4 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
注意:确保各种服务器正常开启检查端口,否则可能报错
报错信息:
"httpd does not appear to be running and proxying cobbler, or SELinux is in the way. Original traceback:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cobbler/cli.py", line 251, in check_setup"
s.ping()...
原因: 1.httpd服务没启动,2./etc/cobbler/settings配置文件出错,server和next_server这两个IP设置跟本机的IP不同
3.修改配置文件信息
vi /etc/cobbler/settings
server: 192.168.6.86 #cobbler-server,地址
next_server: 192.168.6.86 #tftp-server,地址
default_password_crypted: "$1$5gauF7yL$97Z0QxhcSAikmU4Hw5vou0" #使用openssl passwd -1生成口令
manage_dhcp:1 #"1"表示通过cobbler管理dhcp服务器,"0"表示不使用cobbler管理
systemctl restart cobblerd.service
vi /etc/cobbler/dhcp.template #cobbler-dhcp配置文件
subnet 192.168.6.0 netmask 255.255.255.0 {
option routers 192.168.6.1; #gateway
option domain-name-servers 8.8.8.8; #dns
option subnet-mask 255.255.255.0; #netmask
range dynamic-bootp 192.168.6.100 192.168.6.254;
default-lease-time 21600;
max-lease-time 43200;
...
}
cobbler sync #修改配置文件后同步
systemctl restart cobblerd.service
4.下载相关配置文件
cobbler get-loaders #下载配置文件
/var/lib/cobbler/loaders/ #默认下载路径
cobbler sync #同步文件,拷贝文件到/var/lib/tftpboot/
5.vi /etc/cobbler/dhcp.template [cobbdhcp_dhcp配置]
subnet
cobbler sync
systemctl restart chdpd
6.挂载光盘,导入镜像
mkdir /mnt/centos{6,7}
echo "/dev/sr0 /mnt/centos6 iso9660 defaults,loop 0 0" >> /etc/fstab
echo "/dev/sr1 /mnt/centos7 iso9660 defaults,loop 0 0" >> /etc/fstab
cobbler import --path=/mnt/centos6 --name=Centos-6.9-x86_64 --arch=x86_64 #导入镜像文件,[导入完成后,默认会生成最小化安装应答文件]
cobbler import --path=/mnt/centos7 --name=Centos-7.4-x86_64 --arch=x86_64 #导入镜像文件
/var/www/ks_mirror #所导入镜像文件存储目录[httpd服务器根目录]
--path #镜像挂载路径
--name #系统名称
--arch #指定架构
cobbler distro list #导入完成后可查看信息
cobbler --help #查看帮助信息
cobbler distro remove --name=centos-6.9-i386 #删除"cobbler distro list"所查询到的多余条目信息
cobbler profile remove --name=centos-6.9-i386 #删除的是/var/lib/tftpboot/pxelinux.cfg/default配置文件对应的条目
#完成以上操作步骤,即可自动化安装系统,也可自行定制应答文件并关联
7.配置及拷贝自定义应答文件
vi ks*-mini_install.cfg
url --url=$tree #注意:应答文件路径必须修改,引用变量"$tree"即可
...
/var/lib/cobbler/kickstarts/ #cobbler应答文件存放目录
cp ks6-mini_install.cfg /var/lib/cobbler/kickstarts/
cp ks7-mini_install.cfg /var/lib/cobbler/kickstarts/
8.关联应答文件
cobbler profile add --name=Centos-6.9-x86_64_mini --distro=Centos-6.9-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks6-mini_install.cfg
cobbler profile add --name=centos-7.4-x86_64_mini --distro=Centos-7.4-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks7-mini_install.cfg
--name #启动安装时菜单的名称自定义即可
--distro #与"cobbler distro list"命令查询到系统版本相对应
--kickstart #应答文件目录
cobbler distro list
cobbler profile remove --name=centos-6.9-86_64 #删除系统自带
基于WEB界面
cobbler-web
提供cobbler的基于web管理界面,epel源
认证方式
认证方法配置文件:/etc/cobbler/modules.conf
支持多种认证方法:
authn_configfile
authn_pam
#安装软件包
yum install cobbler-web; rpm -ql cobbler-web
systemctl restart httpd
https://192.168.6.68/cobbler_web/ #注意使用https协议访问
#用户创建2种方法
1).
vi /etc/cobbler/modules.conf
...
authn_configfile -- use /etc/cobbler/users.digest (for basic setups) #"/etc/cobbler/users.digest"文件存放可以登录cobbler网站账号
...
[authentication]
module = authn_configfile #定义默认验证方法
...
htdigest -c /etc/cobbler/users.digest Cobbler coadm #创建管理账号coadm,给予cobbler程序使用
> 注意:Cobbler首字母要大写
/etc/cobbler/users.digest #存放用户账号信息
2).
vi /etc/cobbler/modules.conf
...
[authentication]
module = authn_pam
/etc/cobbler/users.conf #存放用户账号的配置文件
useradd -s/sbin/nologin coadm
echo "pass" | passwd --stdin coadm
vi /etc/users.conf #配置文件中添加新建的账号"coadm"
admin = "coadm"
...
systemctl restart cobbler.server