标签:cobbler 管理工具 仓库管理 服务器 管理系统 虚拟机
学习cobbler的话,必须先搞懂kickstart,原理不是,不懂如何排错。
kickstart部署请点击这里
Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。
Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。
Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。
Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack。
cobbler官网
PXE服务支持
DHCP服务管理
DNS服务管理(可选bind,dnsmasq)
电源管理
Kickstart服务支持
YUM仓库管理
TFTP(PXE启动时需要)
Apache(提供kickstart的安装源,并提供定制化的kickstart配置)
[root@CentOS6 ~]# cat /etc/redhat-releaseCentOS release 6.8 (Final) [root@CentOS6 ~]# uname -r2.6.32-642.el6.x86_64[root@CentOS6 ~]# getenforceDisabled[root@CentOS6 ~]# /etc/init.d/iptables statusiptables: Firewall is not running. [root@CentOS6 ~]# ifconfig eth0|awk -F "[ :]+" ‘NR==2 {print $4}‘10.0.0.101[root@CentOS6 ~]# hostnameCentOS6[root@CentOS6 ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
注意:
虚拟机网卡采用NAT模式,不要使用桥接模式,因为稍后我们会搭建DHCP服务器,在同一局域网多个DHCP服务会有冲突。
VMware的NAT模式的dhcp服务也关闭,避免干扰。
需要epel源
[root@CentOS6 ~]# yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd
[root@CentOS6 ~]# rpm -ql cobbler # 查看安装的文件,下面列出部分。/etc/cobbler # 配置文件目录/etc/cobbler/settings # cobbler主配置文件,这个文件是YAML格式,Cobbler是python写的程序。/etc/cobbler/dhcp.template # DHCP服务的配置模板/etc/cobbler/tftpd.template # tftp服务的配置模板/etc/cobbler/rsync.template # rsync服务的配置模板/etc/cobbler/iso # iso模板配置文件目录/etc/cobbler/pxe # pxe模板文件目录/etc/cobbler/power # 电源的配置文件目录/etc/cobbler/users.conf # Web服务授权配置文件/etc/cobbler/users.digest # 用于web访问的用户名密码配置文件/etc/cobbler/dnsmasq.template # DNS服务的配置模板/etc/cobbler/modules.conf # Cobbler模块配置文件/var/lib/cobbler # Cobbler数据目录/var/lib/cobbler/config # 配置文件/var/lib/cobbler/kickstarts # 默认存放kickstart文件/var/lib/cobbler/loaders # 存放的各种引导程序/var/www/cobbler # 系统安装镜像目录/var/www/cobbler/ks_mirror # 导入的系统镜像列表/var/www/cobbler/images # 导入的系统镜像启动文件/var/www/cobbler/repo_mirror # yum源存储目录/var/log/cobbler # 日志目录/var/log/cobbler/install.log # 客户端系统安装日志/var/log/cobbler/cobbler.log # cobbler日志
cobbler check
[root@CentOS6 ~]# cobbler checkThe 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/tftp4 : 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/rsync6 : file /etc/xinetd.d/rsync does not exist7 : debmirror package is not installed, it will be required to manage debian deployments and repositories8 : 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 one9 : 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.
解释一下9条内容
1.改变server的主机名2.第二是DHCP的next_server改成172.16.1.1013.改xined的tftp disable等于no4.5./etc/xinetd.d/rsync 也改成no6.bug,已经存在7.debin系统的源8.生成密码并设置openssl passwd -1 -salt9.fencing tools 高可用的硬件设备。
修改配置文件
命令直接复制粘贴即可
cp /etc/cobbler/settings{,.ori} #备份sed -i ‘s/server: 127.0.0.1/server: 172.16.1.101/‘ /etc/cobbler/settings #服务端IPsed -i ‘s/next_server: 127.0.0.1/next_server: 172.16.1.101/‘ /etc/cobbler/settings #服务端IPsed -i ‘s/manage_dhcp: 0/manage_dhcp: 1/‘ /etc/cobbler/settings #dhcp只获取一次sed -i ‘s/pxe_just_once: 0/pxe_just_once: 1/‘ /etc/cobbler/settings #cobbler只执行一遍sed -ri "/default_password_crypted/s#(.*: ).*#\1\"`openssl passwd -1 -salt ‘oldboy‘ ‘123456‘`\"#" /etc/cobbler/settings #设置密码为123456sed -i ‘s#yes#no#‘ /etc/xinetd.d/rsync #xinet 管理rsyncsed -i ‘s#yes#no#‘ /etc/xinetd.d/tftp #xinet 管理tftpcobbler get-loaders #下载sed -i ‘s#192.168.1#172.16.1#g;22d;23d‘ /etc/cobbler/dhcp.template # 修改dhcp配置文件cobbler sync #写入磁盘/etc/init.d/xinetd restart #启动三个必须启动的服务。详情请看kickstart/etc/init.d/cobblerd restart/etc/init.d/httpd restartcobbler sync # 修改配置文件等,没事就来一次。保证没事
# Cobbler for Kickstart Configurator for CentOS 6.8 by yao zhanginstall url --url=$tree text lang en_US.UTF-8keyboard us zerombr bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"$SNIPPET(‘network_config‘) timezone --utc Asia/Shanghai authconfig --enableshadow --passalgo=sha512 rootpw --iscrypted $default_password_crypted clearpart --all --initlabel part /boot --fstype=ext4 --asprimary --size=200part swap --size=1024part / --fstype=ext4 --grow --asprimary --size=200firstboot --disable selinux --disabled firewall --disabled logging --level=info reboot %pre $SNIPPET(‘log_ks_pre‘) $SNIPPET(‘kickstart_start‘) $SNIPPET(‘pre_install_network_config‘)# Enable installation monitoring$SNIPPET(‘pre_anamon‘) %end %packages @base @compat-libraries @debugging @development tree nmap sysstat lrzsz dos2unix telnet %end %post --nochroot $SNIPPET(‘log_ks_post_nochroot‘) %end %post $SNIPPET(‘log_ks_post‘)# Start yum configuration$yum_config_stanza# End yum configuration$SNIPPET(‘post_install_kernel_options‘) $SNIPPET(‘post_install_network_config‘) $SNIPPET(‘func_register_if_enabled‘) $SNIPPET(‘download_config_files‘) $SNIPPET(‘koan_environment‘) $SNIPPET(‘redhat_register‘) $SNIPPET(‘cobbler_register‘)# Enable post-install boot notification$SNIPPET(‘post_anamon‘)# Start final steps$SNIPPET(‘kickstart_done‘)# End final steps%end
标签:cobbler 管理工具 仓库管理 服务器 管理系统 虚拟机
原文地址:http://523064.blog.51cto.com/513064/1915696