安装教程参考:Cobbler—自动化部署 - 别来无恙- - 博客园 (cnblogs.com)
遇到的一些问题
[root@localhost pxe]# cobbler checkThe following are potential configuration items that you may want to fix:1 : Some network boot-loaders are missing from /var/lib/cobbler/loaders. 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.2 : debmirror package is not installed, it will be required to manage debian deployments and repositoriesRestart cobblerd and then run 'cobbler sync' to apply changes.
出现1所示的问题其实不要紧,新版本不需要处理,只需要安装syslinux ( yum install -y syslinux )就行了
2不用关心
重要文件位置汇总
查看文件的命令
rpm -ql cobbler
配置文件目录:
/etc/cobbler
/etc/cobbler/settings —— cobbler 主配置文件
/etc/cobbler/iso —— iso模板配置文件
/etc/cobbler/pxe —— pxe模板文件
/etc/cobbler/power —— 电源配置文件
/etc/cobbler/user.conf —— web服务授权配置文件
/etc/cobbler/users.digest —— web访问的用户名密码配置文件
/etc/cobbler/dhcp.template —— dhcp服务器的的配置末班
/etc/cobbler/dnsmasq.template —— dns服务器的配置模板
/etc/cobbler/tftpd.template —— tftp服务的配置模板
/etc/cobbler/modules.conf —— 模块的配置文件
数据目录:
/var/lib/cobbler/config/ —— 用于存放distros,system,profiles 等信 息配置文件
/var/lib/cobbler/triggers/ —— 用于存放用户定义的cobbler命令
/var/lib/cobbler/kickstarts/ —— 默认存放kickstart文件
/var/lib/cobbler/loaders/ —— 存放各种引导程序 镜像目录
/var/www/cobbler/ks_mirror/ —— 导入的发行版系统的所有数据
/var/www/cobbler/images/ —— 导入发行版的kernel和initrd镜像用于 远程网络启动
/var/www/cobbler/repo_mirror/ —— yum 仓库存储目录
日志目录:
/var/log/cobbler/installing —— 客户端安装日志
/var/log/cobbler/cobbler.log —— cobbler日志
/var/lib/dhcpd —— dhcp日志
只分配ip而不装机
只发挥dhcp的功能而不使用pxe下发系统镜像装机,关闭xinetd即可
systemctl stop xinetd
自定义装机菜单
我不希望超时后自动选择local
需要修改的配置文件是pxedefault.template
vim /etc/cobbler/pxe/pxedefault.template
实际菜单文件起作用的是/var/lib/tftpboot/pxelinux.cfg/default,但不需要修改这个
修改的地方:
TIMEOUT后面的数字,把超时时间改成了5秒
把原来的local的LABEL删掉
从/var/lib/tftpboot/pxelinux.cfg/default文件中复制过来CentOS-7-x86_64的LABEL
加一行MENU LABEL
将ONTIMEOUT后面改成CentOS-7-x86_64,指定超时后要自动安装的系统
修改完的文件:
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.io/
TIMEOUT 50
TOTALTIMEOUT 6000
ONTIMEOUT CentOS-7-x86_64
LABEL CentOS-7-x86_64
MENU LABEL
kernel /images/CentOS-7-x86_64/vmlinuz
MENU LABEL CentOS-7-x86_64
append initrd=/images/CentOS-7-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.146.111/cblr/svc/op/ks/profile/CentOS-7-x86_64
ipappend 2
$pxe_menu_items
MENU end
修改完好后别忘了同步
cobbler sync
cobbler system 自定义安装命令
根据机器的mac地址分配对应的固定ip,系统等,不然的话就根据配置的网段自动装机了
cobbler system add --name=node2 --mac=00:50:56:3B:70:9B --profile=CentOS-7-x86_64 --ip-address=192.168.146.112 --subnet=255.255.255.0 --gateway=192.168.146.2 --interface=eth0 --static=1 --hostname=linux-node2 --name-servers="192.168.146.2" --kickstart=/var/lib/cobbler/kickstarts/sample_end.ks
Koan自动重装
安装
yum install -y koan
查看可以重装的系统
—server指定cobbler服务ip
koan --server=192.168.146.111 --list=profiles
重装命令,在要重装的服务器上执行
koan --replace-self --server=192.168.146.111 --profile=CentOS-7-x86_64
