前言
Cobbler是一个自动化和简化系统安装的工具,通过使用网络引导来控制和启动安装。Cobbler的特性包括存储库镜像、Kickstart模板和连接电源管理系统。使用Cobbler之前需要先了解下PXE和Kickstart的基本原理,文章包含了Cobbler工作原理和Cobbler部署实践两部分内容,交叉关联性的内容还是蛮多的,遇到报错也不要怕,都会一步一步解决的。
使用Cobbler轻松设置和管理网络安装环境
更新记录
2016年04月12日 - 初稿
阅读原文 -
扩展阅读
Cobbler Manuals -
自动化运维工具Cobbler -Cobbler工作原理
Cobbler由Python语言开发,是对PXE和Kickstart以及DHCP的封装。融合很多特性,提供了CLI和Web的管理形式。更加方便的实行网络安装。同时,Cobbler也提供了API接口,使用其它语言也很容易做扩展。它不紧可以安装物理机,同时也支持kvm、xen虚拟化、Guest OS的安装。更多的是它还能结合Puppet等集中化管理软件,实现自动化的管理。
Cobbler 支持众多的发行版:Red Hat、Fedora、CentOS、Debian、Ubuntu 和 SuSE。当添加一个操作系统(通常通过使用 ISO 文件)时,Cobbler 知道如何解压缩合适的文件并调整网络服务,以正确引导机器。Cobbler 使用命令行方式管理,也提供了基于Web的图形化配置管理工具(cobbler-web)。通过配置cobbler自动部署DHCP、TFTP、HTTP,在安装过程中加载kiskstart无人值守安装应答文件实现无人值守。从客户端使用PXE引导启动安装。
Server端
第一步,启动Cobbler服务第二步,进行Cobbler错误检查,执行cobbler check命令第三步,进行配置同步,执行cobbler sync命令第四步,复制相关启动文件文件到TFTP目录中第五步,启动DHCP服务,提供地址分配第六步,DHCP服务分配IP地址第七步,TFTP传输启动文件第八步,Server端接收安装信息第九步,Server端发送ISO镜像与Kickstart文件Client端
第一步,客户端以PXE模式启动第二步,客户端获取IP地址第三步,通过TFTP服务器获取启动文件第四步,进入Cobbler安装选择界面第五步,客户端确定加载信息第六步,根据配置信息准备安装系统第七步,加载Kickstart文件第八步,传输系统安装的其它文件第九步,进行安装系统Cobbler部署实践
#设置YUM源cd /etc/yum.repo.d/vi epel.repo[epel]name=Extra Packages for Enterprise Linux 6 - $basearchbaseurl=http://download.fedoraproject.org/pub/epel/6/$basearch#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearchfailovermethod=priorityenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6[epel-debuginfo]name=Extra Packages for Enterprise Linux 6 - $basearch - Debugbaseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearchfailovermethod=priorityenabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6gpgcheck=1[epel-source]name=Extra Packages for Enterprise Linux 6 - $basearch - Sourcebaseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearchfailovermethod=priorityenabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6gpgcheck=1#导入GPG keysudo rpm --import http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6#修改repo文件添加CentOS 6.X的YUM源cd /etc/yum.repos.d/cp rhel-source.repo rhel-source.repo.bakvi rhel-source.repo[base]name=CentOS-$releasever-Basebaseurl=http://centos.ustc.edu.cn/centos/6/os/x86_64/gpgcheck=1gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6[updates]name=CentOS-$releasever-Updatesbaseurl=http://centos.ustc.edu.cn/centos/6/os/x86_64/gpgcheck=1gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6[extras]name=CentOS-$releasever-Extrasbaseurl=http://centos.ustc.edu.cn/centos/6/os/x86_64/gpgcheck=1gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6[centosplus]name=CentOS-$releasever-Plusbaseurl=http://centos.ustc.edu.cn/centos/6/os/x86_64/gpgcheck=1#清除缓存查看是否生效yum clean allyum makecacheyum repolist#直接cobbler关联依赖包yum install cobbler cobbler-web httpd rsync tftp-server xinetd dhcp python-ctypes debmirror pykickstart cman fence-agents dnsmasq#使用yum-plugin-downloadonly插件yum install -y yum-plugin-downloadonlyyum install --downloadonly --downloaddir=/tmp/cobbler cobbler cobbler-web httpd rsync tftp-server xinetd dhcp python-ctypes debmirror pykickstart cman fence-agents dnsmasq#必要服务(1)cobbler (cobbler的核心)(2)httpd (提供cobbler的web界面)(3)dhcpd (为自动安装系统分配IP地址)(4)epel-release (为之提供yum源)(5)rsync (cobbler需要同步信息)(6)cobbler-web (cobbler的一个web插件)(7)xinetd (为rsync和tftp的守护进程)(8)tftp (传送安装的一些文件的类似ftp)#检查cobbler配置,常见错误如下cobbler check1 : 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 : ksvalidator was not found, install pykickstart9 : 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 one10 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them1.编辑/etc/cobbler/settings文件,找到 server选项,修改为本机IP即可2.编辑/etc/cobbler/settings文件,找到 next_server选项,修改为本机IP即可3.SELinux的设置, 如果上面已经关闭了SELinux就不用管了4.执行 cobbler get-loaders,系统将自动下载loader程序,完成提示4的修复工作。5.编辑/etc/xinetd.d/tftp文件,将文件中的disable字段的配置由yes改为no6.编辑/etc/xinetd.d/rsync文件,将文件中的disable字段的配置由yes改为no7.在iptables中将69,80,25151端口打开。如果仅仅只是在内部环境中使用,建议直接将防火墙关掉8.提示说debmirror没安装。如果不是安装 debian之类的系统,此提示可以忽略9.修改cobbler用户的默认密码,可以使用如下命令生成密码,并使用生成后的密码替换/etc/cobbler/settings中的密码。生成密码命令:openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'其中“random-phrase-here”为任意字符10.安装cman或者fence-agents#关闭selinux/iptablessed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/configsetenforce 0chkconfig iptables offservice iptables stop#设置tftp服务和rsync服务sed -i '/disable/c\\tdisable\t\t\t= no' /etc/xinetd.d/tftpsed -i -e 's/\=\ yes/\=\ no/g' /etc/xinetd.d/rsync#设置DHCP server的IPsed -i 's/next_server: 127.0.0.1/next_server: 172.28.70.245/g' /etc/cobbler/settings #设置cobbler的IPsed -i 's/server: 127.0.0.1/server: 172.28.70.245/g' /etc/cobbler/settings #设置Cobbler管理rsyncsed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings #设置Cobbler管理DHCPsed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings#设置Cobbler一次安装开关(可选)sed -i 's/pxe_just_once: 0/pxe_just_once: 1/g' /etc/cobbler/settings#设置Cobbler管理DNS(可选)sed -i 's/manage_dns: 0/manage_dns: 1/g' /etc/cobbler/settings#开启动态更新(可选)sed -i 's/allow_dynamic_settings: 0/allow_dynamic_settings: 1/g' /etc/cobbler/settings#设置debmirrorsed -i -e 's/@dists=/#@dists=/g' /etc/debmirror.confsed -i -e 's/@arches=/#@arches=/g' /etc/debmirror.conf#编辑dnsmasq.template中dhcp-range部分#vi /etc/cobbler/dnsmasq.templatevi /etc/dnsmasq.conf# Cobbler generated configuration file for dnsmasq# $date## resolve.conf .. ?#no-poll#enable-dbusread-ethersaddn-hosts = /var/lib/cobbler/cobbler_hostsdhcp-range=172.28.70.246,172.28.70.250dhcp-option=3,$next_serverdhcp-lease-max=1000dhcp-authoritativedhcp-boot=pxelinux.0dhcp-boot=net:normalarch,pxelinux.0dhcp-boot=net:ia64,$elilo#重启dnsmasq/etc/init.d/dnsmasq restart#编辑dhcp.templatecp /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.bakvi /etc/cobbler/dhcp.template# ******************************************************************# Cobbler managed dhcpd.conf file## generated from cobbler dhcp.conf template ($date)# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be# overwritten.## ******************************************************************ddns-update-style interim;allow booting;allow bootp;ignore client-updates;set vendorclass = option vendor-class-identifier;option pxe-system-type code 93 = unsigned integer 16;subnet 172.28.70.0 netmask 255.255.255.0 { option routers 172.28.70.254; option domain-name-servers 172.28.70.254; option subnet-mask 255.255.255.0; range dynamic-bootp 172.28.70.246 172.28.70.250; default-lease-time 21600; max-lease-time 43200; next-server $next_server; class "pxeclients" { match if substring (option vendor-class-identifier, 0, 9) = "PXEClient"; if option pxe-system-type = 00:02 { filename "ia64/elilo.efi"; } else if option pxe-system-type = 00:06 { filename "grub/grub-x86.efi"; } else if option pxe-system-type = 00:07 { filename "grub/grub-x86_64.efi"; } else { filename "pxelinux.0"; } }}#for dhcp_tag in $dhcp_tags.keys(): ## group could be subnet if your dhcp tags line up with your subnets ## or really any valid dhcpd.conf construct ... if you only use the ## default dhcp tag in cobbler, the group block can be deleted for a ## flat configuration# group for Cobbler DHCP tag: $dhcp_taggroup { #for mac in $dhcp_tags[$dhcp_tag].keys(): #set iface = $dhcp_tags[$dhcp_tag][$mac] host $iface.name { hardware ethernet $mac; #if $iface.ip_address: fixed-address $iface.ip_address; #end if #if $iface.hostname: option host-name "$iface.hostname"; #end if #if $iface.netmask: option subnet-mask $iface.netmask; #end if #if $iface.gateway: option routers $iface.gateway; #end if #if $iface.enable_gpxe: if exists user-class and option user-class = "gPXE" { filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner"; } else if exists user-class and option user-class = "iPXE" { filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner"; } else { filename "undionly.kpxe"; } #else filename "$iface.filename"; #end if ## Cobbler defaults to $next_server, but some users ## may like to use $iface.system.server for proxied setups next-server $next_server; ## next-server $iface.next_server; } #end for}#end for#将dns和dhcp的管理引擎都配置为dnsmasq,修改/etc/cobbler/modules.confvi /etc/cobbler/modules.conf[authentication]module = authn_configfile[dns]module = manage_dnsmasq[dhcp]module = manage_dnsmasq#修改httpd配置并启动vi /etc/httpd/conf/httpd.confServerName 127.0.0.1:80/etc/init.d/httpd restart#设置目标系统root密码,这个设置只对CentOS/RHEL有效PASSWORD="`echo "admin123" | openssl passwd -1 -salt 'root' –stdin`"sed -i s@"^default_password_crypted.*$"@"default_password_crypted: \"$PASSWORD\""@g /etc/cobbler/settings***default_password_crypted: "$1$cobbler$k/5ITeQUOffuOujzEvhjY."***#下载启动菜单,启动报错请尝试service cobblerd restartcobbler get-loaderscobbler@root#cobbler get-loaderstask started: 2016-04-11_092911_get_loaderstask started (id=Download Bootloader Content, time=Mon Apr 11 09:29:11 2016)downloading http://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/READMEdownloading http://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilodownloading http://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yabootdownloading http://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinuxdownloading http://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efidownloading http://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yabootdownloading http://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0downloading http://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32downloading http://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efidownloading http://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi*** TASK COMPLETE ***#重启相关服务并配置自动启动chkconfig cobblerd on chkconfig httpd onchkconfig xinetd onchkconfig dnsmasq onservice httpd restart service xinetd restart service dnsmasq restartservice cobblerd restart #检查并同步cobbler配置,如果有如下报错确认文件存在可以忽略cobbler@ZJ/etc/cobbler#cobbler checkThe following are potential configuration items that you may want to fix:1 : file /etc/xinetd.d/rsync does not existRestart cobblerd and then run 'cobbler sync' to apply changes.cobbler@ZJ/etc/cobbler#cobbler synctask started: 2016-04-11_170138_synctask started (id=Sync, time=Mon Apr 11 17:01:38 2016)running pre-sync triggerscleaning treesremoving: /var/lib/tftpboot/grub/imagescopying bootloaderstrying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboottrying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisktrying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efitrying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.eficopying distros to tftpbootcopying imagesgenerating PXE configuration filesgenerating PXE menu structurerendering DHCP filesrendering DNS filesrendering TFTPD filesgenerating /etc/xinetd.d/tftpcleaning link cachesrendering Rsync filesrunning post-sync triggersrunning python triggers from /var/lib/cobbler/triggers/sync/post/*running python trigger cobbler.modules.sync_post_restart_servicesrunning: service dnsmasq restartreceived on stdout: Shutting down dnsmasq: [ OK ]Starting dnsmasq: [ OK ]received on stderr: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_trackrunning shell triggers from /var/lib/cobbler/triggers/change/**** TASK COMPLETE ***#开启动态编辑后的效果cobbler setting reportcobbler setting report [--name=option]allow_duplicate_hostnames : 0allow_duplicate_ips : 0allow_duplicate_macs : 0allow_dynamic_settings : 1always_write_dhcp_entries : 0anamon_enabled : 0auth_token_expiration : 3600authn_pam_service : loginbind_chroot_path :bind_master : 127.0.0.1build_reporting_email : ['root@localhost']build_reporting_enabled : 0build_reporting_ignorelist : ['']build_reporting_sender :build_reporting_smtp_server : localhostbuild_reporting_subject :build_reporting_to_address :buildisodir : /var/cache/cobbler/buildisocheetah_import_whitelist : ['random', 're', 'time']client_use_https : 0client_use_localhost : 0cobbler_master :consoles : /var/consolescreaterepo_flags : -c cache -s shadefault_deployment_method : sshdefault_kickstart : /var/lib/cobbler/kickstarts/default.ksdefault_name_servers : []default_name_servers_search : []default_ownership : ['admin']default_password_crypted : $1$root$JX8M6OcOn.pjk0pHdnG0y0default_template_type : cheetahdefault_virt_bridge : xenbr0default_virt_disk_driver : rawdefault_virt_file_size : 5default_virt_ram : 512default_virt_type : xenpvenable_gpxe : 0enable_menu : 1func_auto_setup : 0func_master : overlord.example.orghttp_port : 80isc_set_host_name : 0iso_template_dir : /etc/cobbler/isokerberos_realm : EXAMPLE.COMkernel_options : {'ksdevice': 'bootif', 'lang': ' ', 'text': '~'}kernel_options_s390x : {'vnc': '~', 'ip': False, 'RUNKS': 1, 'ramdisk_size': 40000, 'ro': '~', 'root': '/dev/ram0'}ldap_anonymous_bind : 1ldap_base_dn : DC=example,DC=comldap_management_default_type : authconfigldap_port : 389ldap_search_bind_dn :ldap_search_passwd :ldap_search_prefix : uid=ldap_server : ldap.example.comldap_tls : 1ldap_tls_cacertfile :ldap_tls_certfile :ldap_tls_keyfile :manage_dhcp : 1manage_dns : 1manage_forward_zones : []manage_reverse_zones : []manage_rsync : 1manage_tftp : 1manage_tftpd : 1mgmt_classes : []mgmt_parameters : {'from_cobbler': 1}next_server : 172.28.70.245power_management_default_type : ipmitoolpower_template_dir : /etc/cobbler/powerproxy_url_ext :proxy_url_int :puppet_auto_setup : 0puppet_parameterized_classes : 1puppet_server : puppetpuppet_version : 2puppetca_path : /usr/bin/puppetpxe_just_once : 1pxe_template_dir : /etc/cobbler/pxeredhat_management_key :redhat_management_permissive : 0redhat_management_server : xmlrpc.rhn.redhat.comredhat_management_type : offregister_new_installs : 0remove_old_puppet_certs_automatically : 0replicate_repo_rsync_options : -avzHreplicate_rsync_options : -avzHreposync_flags : -l -n -drestart_dhcp : 1restart_dns : 1restart_xinetd : 1run_install_triggers : 1scm_track_enabled : 0scm_track_mode : gitserializer_pretty_json : 0server : 172.28.70.245sign_puppet_certs_automatically : 0signature_path : /var/lib/cobbler/distro_signatures.jsonsignature_url : http://cobbler.github.io/signatures/2.6.x/latest.jsonsnippetsdir : /var/lib/cobbler/snippetstemplate_remote_kickstarts : 0virt_auto_boot : 1webdir : /var/www/cobblerxmlrpc_port : 25151yum_distro_priority : 1yum_post_install_mirror : 1yumdownloader_flags : --resolve#修改seting文件cobbler登陆服务器地址cobbler setting edit --name=server --value=172.28.0.1#ks脚本关闭pxe,这样就不会重复安装cobbler setting edit --name=pxe_just_once --value=1#TFTP服务器 IP地址cobbler setting edit --name=next_server --value=172.28.0.1#cobbler管理rsync,dhcp,dnscobbler setting edit --name=manage_rsync --value=1cobbler setting edit --name=manage_dhcp --value=1cobbler setting edit --name=manage_dns --value=1
cobbler导入镜像
#使用镜像文件mount -o loop /tmp/rhel-server-6.3-x86_64-dvd.iso /mnt/rhel63#使用光盘mount /dev/sr0 /mnt/rhel63#执行镜像导入,并关联自定义的自动安装配置ks脚本,这个地方我们可以为不同的系统版本指定不同的自动安装ks脚本(这个过程实际比较长,cobbler会把软件整个复制一份到本地,在这之前,务必确认硬盘空间足够装下镜像)cobbler import --path=/tmp/rhel63 --name=rhel63 --kickstart=/var/lib/cobbler/kickstarts/rhel63.cfgtask started: 2016-04-12_090326_importtask started (id=Media import, time=Tue Apr 12 09:03:26 2016)Found a candidate signature: breed=redhat, version=rhel6Found a matching signature: breed=redhat, version=rhel6Adding distros from path /var/www/cobbler/ks_mirror/rhel63:creating new distro: rhel63-x86_64trying symlink: /var/www/cobbler/ks_mirror/rhel63 -> /var/www/cobbler/links/rhel63-x86_64creating new profile: rhel63-x86_64associating reposchecking for rsync repo(s)checking for rhn repo(s)checking for yum repo(s)starting descent into /var/www/cobbler/ks_mirror/rhel63 for rhel63-x86_64processing repo at : /var/www/cobbler/ks_mirror/rhel63need to process repo/comps: /var/www/cobbler/ks_mirror/rhel63looking for /var/www/cobbler/ks_mirror/rhel63/repodata/*comps*.xmlKeeping repodata as-is :/var/www/cobbler/ks_mirror/rhel63/repodataprocessing repo at : /var/www/cobbler/ks_mirror/rhel63/HighAvailabilityneed to process repo/comps: /var/www/cobbler/ks_mirror/rhel63/HighAvailabilitylooking for /var/www/cobbler/ks_mirror/rhel63/HighAvailability/repodata/*comps*.xmlKeeping repodata as-is :/var/www/cobbler/ks_mirror/rhel63/HighAvailability/repodataprocessing repo at : /var/www/cobbler/ks_mirror/rhel63/Serverneed to process repo/comps: /var/www/cobbler/ks_mirror/rhel63/Serverlooking for /var/www/cobbler/ks_mirror/rhel63/Server/repodata/*comps*.xmlKeeping repodata as-is :/var/www/cobbler/ks_mirror/rhel63/Server/repodataprocessing repo at : /var/www/cobbler/ks_mirror/rhel63/LoadBalancerneed to process repo/comps: /var/www/cobbler/ks_mirror/rhel63/LoadBalancerlooking for /var/www/cobbler/ks_mirror/rhel63/LoadBalancer/repodata/*comps*.xmlKeeping repodata as-is :/var/www/cobbler/ks_mirror/rhel63/LoadBalancer/repodataprocessing repo at : /var/www/cobbler/ks_mirror/rhel63/ScalableFileSystemneed to process repo/comps: /var/www/cobbler/ks_mirror/rhel63/ScalableFileSystemlooking for /var/www/cobbler/ks_mirror/rhel63/ScalableFileSystem/repodata/*comps*.xmlKeeping repodata as-is :/var/www/cobbler/ks_mirror/rhel63/ScalableFileSystem/repodataprocessing repo at : /var/www/cobbler/ks_mirror/rhel63/ResilientStorageneed to process repo/comps: /var/www/cobbler/ks_mirror/rhel63/ResilientStoragelooking for /var/www/cobbler/ks_mirror/rhel63/ResilientStorage/repodata/*comps*.xmlKeeping repodata as-is :/var/www/cobbler/ks_mirror/rhel63/ResilientStorage/repodata*** TASK COMPLETE ***#查看cobbler导入结果cobbler distro listcobbler report#验证ks有效性,剩下的就是PXE引导测试了cobbler validateks
cobbler-web
#设置Web登录,cobbler 2.6以上版本已经无需修改sed -i 's/module = authn_denyall/module = authn_configfile/g' /etc/cobbler/modules.conf#设置Cobbler Web登录用户登录密码htdigest /etc/cobbler/users.digest "Cobbler" cobblerChanging password for user cobbler in realm CobblerNew password:cobblerRe-type new password:cobbler#cobbler_web登录地址,推荐使用命令行管理http://{IP}/cobbler_web
Cobbler相关选项说明
#Cobbler 常用命令详解cobbler check #检查cobbler配置cobbler sync #同步配置到dhcp/pxe和数据目录cobbler list #列出所有的cobbler元素cobbler import #导入安装的系统镜像cobbler report #列出各元素的详细信息cobbler distro #查看导入的发行版系统信息cobbler profile #查看配置信息cobbler system #查看添加的系统信息cobbler reposync #同步yum仓库到本地#导入镜像文件命令:cobbler import --path=镜像路径 -- name=安装引导名 --arch=32位或64位参数:path 是镜像所挂载的目录name 是导入到cobbler里面显示的名字arch 是32位系统还是64位系统#导入kickstart文件命令:cobbler profile add --name=list名 --distro=镜像 --kickstart=路径参数:name是表示添加的ks 的名字,用cobbler report可以看到这个名字distro 是用哪个镜像,list的distros里面选择一个,需要版本相对应kickstart 是具体的 ks 文件路径#同步DHCP、HTTPD命令:cobbler sync注,每次修改完dhcp.template之类的配置文件需要执行一次使其生效。#查看Cobbler列表命令:cobbler list注,列出Cobbler所有的元素。#删除相关列表命令:cobbler distro/profile remove --name=要删除的引导文件名删除指定 distro , 也就是镜像删除指定的 profile 文件,也就是 ks#Cobbler安装后目录说明cobbler配置文件目录/etc/cobbler:/etc/cobbler/settings #cobbler主配置文件/etc/cobbler/iso/ #iso模板配置文件/etc/cobbler/pxe #pxe模板文件/etc/cobbler/power #电源的配置文件/etc/cobbler/users.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 #Cobbler模块配置文件cobbler数据目录/var/lib/cobbler:/var/lib/cobbler/config/ #用于存放distros、systems、profiles等信息配置文件/var/lib/cobbler/triggers #用于存放用户定义的cobbler 命令/var/lib/cobbler/kickstarts/ #默认存放kickstart文件/var/lib/cobbler/loaders #存放的各种引导程序镜像数据目录/var/www/cobbler:/var/www/cobbler/ks_mirror/ #导入的发行版系统的所有数据/var/www/cobbler/images/ #导入发行版的Kernel和initrd镜像用于远程网络启动/var/www/cobbler/repo_mirror/ #yum仓库存储目录日志目录 /var/log/cobbler/:/var/log/cobbler/install.log #客户端的安装系统日志/var/log/cobbler/cobbler.log #cobbler日志
常见问题
#多查看错误日志less /var/log/cobbler/cobbler.log#为cobbler-web重置用户密码htdigest /etc/cobbler/users.digest "Cobbler" cobbler#添加新用户htdigest /etc/cobbler/users.digest "Cobbler" usernam#DHCP多网卡环境可以指定网卡vi /etc/sysconfig/dhcpd# Command line options hereDHCPDARGS=eth0