cobbler基础配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cobbler基础配置相关的知识,希望对你有一定的参考价值。
cobbler:
pxe的二次封装:python语言开发,可以为我们提供dhcp服务以及tftp服务;
可以实现多环境的pxe共存
pxe:dhcp,tftp
程序包:cobbler(epel)
服务:CentOS 7:systemctl start cobblerd.service
核心概念:distro,profile,system
cobbler:distro(repository)-->profile(kickstart)-->system(ip/mask)
测试环境:CentOS7
一、配置及启动cobbler所依赖的各服务
[[email protected] ~]# yum install -y cobbler [[email protected] ~]# rpm -ql cobbler | grep "\<settings\>" /etc/cobbler/settings #此为cobbler的主配置文件 /usr/lib/python2.7/site-packages/cobbler/settings.py /usr/lib/python2.7/site-packages/cobbler/settings.pyc /usr/lib/python2.7/site-packages/cobbler/settings.pyo [[email protected] ~]# systemctl start cobblerd #启动cobbler [[email protected] ~]# cobbler check #进行cobbler check,我们需要解决cobbler所报出的问题,其中第3、4、7问题可以暂时忽略。 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 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment: https://github.com/cobbler/cobbler/wiki/Selinux 4 : change ‘disable‘ to ‘no‘ in /etc/xinetd.d/tftp 5 : 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. 6 : file /etc/xinetd.d/rsync does not exist 7 : debmirror package is not installed, it will be required to manage debian deployments and repositories 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 9 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them Restart cobblerd and then run ‘cobbler sync‘ to apply changes. [[email protected] cobbler]# grep "^server" settings #第一个问题的解决方案 server: 172.16.61.2 #指向本地可以与外界通信的地址 [[email protected] cobbler]# grep "^next_server" settings #第二个问题的解决 next_server: 172.16.61.2 #指向tftp地址 [[email protected] cobbler]# grep "^default_password" settings #第八个问题的解决 default_password_crypted: "$6$2Mf6mBdf$zoPVM3cv2Vgx4VIwSMJWSrIqYquBT1O686shIJEBYfmq3od9lgWtq301r39wkn8.gJrBI/oaWYU93kmXRbduP/" [[email protected] cobbler]# cp /usr/share/syslinux/{pxelinux.0,menu.c32} /var/lib/cobbler/loaders/ #第五个问题的解决方案 [[email protected] cobbler]# cobbler sync #执行cobbler sync task started: 2016-02-23_140634_sync task started (id=Sync, time=Tue Feb 23 14:06:34 2016) running pre-sync triggers cleaning trees removing: /var/lib/tftpboot/pxelinux.cfg/default removing: /var/lib/tftpboot/grub/images removing: /var/lib/tftpboot/grub/efidefault removing: /var/lib/tftpboot/s390x/profile_list copying bootloaders copying: /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0 copying: /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32 copying: /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk copying distros to tftpboot copying images generating PXE configuration files generating PXE menu structure rendering TFTPD files generating /etc/xinetd.d/tftp cleaning link caches running post-sync triggers running python triggers from /var/lib/cobbler/triggers/sync/post/* running python trigger cobbler.modules.sync_post_restart_services running shell triggers from /var/lib/cobbler/triggers/sync/post/* running python triggers from /var/lib/cobbler/triggers/change/* running python trigger cobbler.modules.scm_track running shell triggers from /var/lib/cobbler/triggers/change/* *** TASK COMPLETE ***
二、配置dhcp服务
option domain-name "tz.com"; option domain-name-servers 172.16.0.1; default-lease-time 3600; max-lease-time 7200; log-facility local7; subnet 172.16.0.0 netmask 255.255.0.0 { range 172.16.61.1 172.16.61.61; option routers 172.16.61.2; filename "pxelinux.0"; next-server 172.16.61.2; } [[email protected] cobbler]# systemctl start dhcpd #启动dhcp服务
三、管理cobbler
[[email protected] cobbler]# cobbler import --help #使用import命令将光盘制作为distro Usage: cobbler [options] Options: -h, --help show this help message and exit --arch=ARCH OS architecture being imported --breed=BREED the breed being imported --os-version=OS_VERSION the version being imported --path=PATH local path or rsync location --name=NAME name, ex ‘RHEL-5‘ --available-as=AVAILABLE_AS tree is here, don‘t mirror --kickstart=KICKSTART_FILE assign this kickstart file --rsync-flags=RSYNC_FLAGS pass additional flags to rsync [[email protected] cobbler]# cobbler import --name="CentOS-7-X86-64-1503" --path=/media/cdrom task started: 2016-02-23_142932_import task started (id=Media import, time=Tue Feb 23 14:29:32 2016) [[email protected] ~]# ls /var/www/cobbler/ks_mirror/ #在该目录下生成我们指定的文件 CentOS-7-X86-64-1503 config [[email protected] cobbler]# cobbler distro list #生成的distro CentOS-7-X86-64-1503-x86_64 [[email protected] cobbler]# cobbler profile list #生成的profile文件 CentOS-7-X86-64-1503-x86_64
注:cobbler会根据profile自动生成kickstart文件
测试结果:
四、cobbler_web
[[email protected] ~]# yum install -y cobbler-web #安装cobbler-web [[email protected] ~]# vim /etc/cobbler/modules.conf [authentication] module = authn_configfile #基于configfile认证 [[email protected] ~]# htdigest -c /etc/cobbler/users.digest Cobbler cobbleradmin #生成管理员用户与密码 Adding password for cobbleradmin in realm Cobbler. New password: Re-type new password: [[email protected] ~]# systemctl restart cobblerd
测试结果:
以上是关于cobbler基础配置的主要内容,如果未能解决你的问题,请参考以下文章