标签:cobbler
cobbler
1、基础安装
#安装cobbler需要配置epel源,以下因供参考
[root@server ~]# cat /etc/yum.repos.d/aliyunepel.repo [epel] name= aliyun epel library baseurl=http://mirrors.aliyun.com/epel/6/x86_64 gpgcheck=0
#安装cobbler kickstart debmirror rsync cman
yum install -y cobbler pykickstart debmirror yum install -y dhcp rsync cman
#清除规则
iptables -F setenforce 0
#设置开机
chkconfig httpd on chkconfig tftp on chkconfig rsync on service xinetd start chkconfig xinetd on
--------------------------------------------------------------------------------------------------------
2、配置cobbler
#执行cobbler get-loaders
[root@server ~]# cobbler get-loaders task started: 2016-05-05_160957_get_loaders task started (id=Download Bootloader Content, time=Thu May 5 16:09:57 2016) path /var/lib/cobbler/loaders/README already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/COPYING.elilo already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/COPYING.yaboot already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/COPYING.syslinux already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/elilo-ia64.efi already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/yaboot already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/pxelinux.0 already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/menu.c32 already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/grub-x86.efi already exists, not overwriting existing content, use --force if you wish to update path /var/lib/cobbler/loaders/grub-x86_64.efi already exists, not overwriting existing content, use --force if you wish to update *** TASK COMPLETE ***
#开启cobbler的服务,并且设置开机自启
service cobblerd start chkconfig cobblerd on
#执行cobbler sync
cobbler sync
#开始配置dhcp服务在/usr/share/doc/dhcp/目录下有一个dhcpd.conf.sample文件,拷贝到/etc/dhcp/dhcpd.conf
cp /usr/share/doc/dhcp/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
[root@cobbler ~]# cat /etc/dhcp/dhcpd.conf option domain-name "example.org"; option domain-name-servers ns1.example.org, ns2.example.org; default-lease-time 600; max-lease-time 7200; log-facility local7; subnet 10.7.0.0 netmask 255.255.255.0 { range 10.7.0.50 10.7.0.100; #ip地址分配的范围 option routers 10.7.0.254; #网关 next-server 10.7.0.119; #cobbler主机的Ip地址 filename "pxelinux.0"; }
#启动dhcp服务
service dhcpd start chkconfig dhcpd start
挂载ISO文件
mount -t iso9660 -o loop /iso/CentOS-6.8-x86_64-minimal.iso /mnt
#修改/etc/cobbler/setings文件:
HostIP=$(/sbin/ip addr show dev eth1 | sed -n 3p | awk ‘{print $2}‘| awk -F\/ ‘{print $1}‘) sed -i ‘s/^\(server:\).*$/\1 ‘$HostIP‘/g‘ /etc/cobbler/settings sed -i ‘s/^\(next_server:\).*$/\1 ‘$HostIP‘/g‘ /etc/cobbler/settings
#制作ks自动安装文件
openssl -1 -salt ‘‘ ‘123456‘ #生成密码可放入/etc/cobbler/settings配置里
[root@cobbler ~]# cat /iso/CentOS6.8-mini.ks auth --useshadow --enablemd5 # System bootloader configuration bootloader --location=mbr # Partition clearing information clearpart --all --initlabel # Use text mode install text # Firewall configuration firewall --enabled # Run the Setup Agent on first boot firstboot --disable # System keyboard keyboard us # System language lang en_US # Use network installation url --url=$tree # If any cobbler repo definitions were referenced in the kickstart profile, include them here. $yum_repo_stanza # Network information $SNIPPET(‘network_config‘) # Reboot after installation reboot #Root password 引用 rootpw --iscrypted $default_password_crypted # SELinux configuration selinux --disabled # Do not configure the X Window System skipx # System timezone timezone --utc Etc/GMT+8 # Install OS instead of upgrade install # Clear the Master Boot Record zerombr # Allow anaconda to partition the system as needed autopart %pre $SNIPPET(‘log_ks_pre‘) $SNIPPET(‘kickstart_start‘) $SNIPPET(‘pre_install_network_config‘) # Enable installation monitoring $SNIPPET(‘pre_anamon‘) %end %packages --nobase @core #$SNIPPET(‘func_install_if_enabled‘) %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 repo(可选)
cobbler repo add --name=CentOS-6-x86_64 --mirror=http://mirrors.163.com/centos/6/os/x86_64/
#执行cobbler镜像
cobbler import --name=Centos6.8 --path=/min --kickstart=/iso/CentOS6.8-mini.ks
--------------------------------------------------------------------------------------------------------
3、查看配置
#查看cobbler镜像
[root@cobbler ~]# cobbler list distros: CentOS6.5-x86_64 CentOS6.8-mini-x86_64 profiles: CentOS6.5-x86_64 CentOS6.8-mini-x86_64 systems: repos: CentOS-6-x86_64 images: mgmtclasses: packages: files:
#删除配置
cobbler profile remove --name=CentOS6.8-mini-x86_64
#删除显示
cobbler distro remove --name=CentOS6.8-mini-x86_64
#查看配置详情
[root@cobbler ~]# cobbler profile report Name : CentOS6.5-x86_64 TFTP Boot Files : {} Comment : DHCP Tag : default Distribution : CentOS6.5-x86_64 Enable gPXE? : 0 Enable PXE Menu? : 1 Fetchable Files : {} Kernel Options : {} Kernel Options (Post Install) : {} Kickstart : /var/lib/cobbler/kickstarts/sample_end.ks Kickstart Metadata : {} Management Classes : [] Management Parameters : <<inherit>> Name Servers : [] Name Servers Search Path : [] Owners : [‘admin‘] Parent Profile : Internal proxy : Red Hat Management Key : <<inherit>> Red Hat Management Server : <<inherit>> Repos : [] Server Override : <<inherit>> Template Files : {} Virt Auto Boot : 1 Virt Bridge : xenbr0 Virt CPUs : 1 Virt Disk Driver Type : raw Virt File Size(GB) : 5 Virt Path : Virt RAM (MB) : 512 Virt Type : kvm Name : CentOS6.8-mini-x86_64 TFTP Boot Files : {} Comment : DHCP Tag : default Distribution : CentOS6.8-mini-x86_64 Enable gPXE? : 0 Enable PXE Menu? : 1 Fetchable Files : {} Kernel Options : {} Kernel Options (Post Install) : {} Kickstart : /iso/CentOS6.8-mini.ks Kickstart Metadata : {} Management Classes : [] Management Parameters : <<inherit>> Name Servers : [] Name Servers Search Path : [] Owners : [‘admin‘] Parent Profile : Internal proxy : Red Hat Management Key : <<inherit>> Red Hat Management Server : <<inherit>> Repos : [] Server Override : <<inherit>> Template Files : {} Virt Auto Boot : 1 Virt Bridge : xenbr0 Virt CPUs : 1 Virt Disk Driver Type : raw Virt File Size(GB) : 5 Virt Path : Virt RAM (MB) : 512 Virt Type : kvm
--------------------------------------------------------------------------------------------------------
4、Cobbler命令说明
cobbler check
核对当前设置是否有问题
cobbler list
列出所有的cobbler元素
cobbler report
详细的列出个元素
cobbler sync
同步配置到dhcp/pxe和数据目录
cobbler reposync
同步yum仓库
Cobbler配置文件说明
Cobbler配置文件存放在/etc/cobbler下。
配置文件名称
/etc/cobbler/settings
cobbler主配置文件
/etc/cobbler
dhcp、dns、pxe、dnsmasq的模板配置文件
/etc/cobbler/users.digest
用于web访问的用户名密码配置文件
/etc/cobbler/modules.conf
模块配置文件
/etc/cobbler/users.conf
Cobbler WebUI/Web service授权配置文件
Repo数据目录/var/www/cobbler
导入的发行版,repos镜像和kickstart文件都放置在/var/www/cobbler目录下。确保/var目录有足够的空间来存储这些文件。
images/
存储所有导入发行版的Kernel和initrd镜像用于远程网络启动
ks_mirror/
存储导入的发行版
repo_mirror/
yum repos存储目录
/var/log/cobbler
存放日志文件/var/log/cobbler/cobbler.log
Cobbler数据目录/var/lib/cobbler,此目录存储和Cobbler profiles、systems、distros相关的配置。
configs/
存储distros、repos、systems和profiles相关信息
backup/
备份目录
snippets/
放置一些可以在kickstarts导入的脚本小片段
triggers/
放置一些可执行脚本
kickstarts/
放置kickstart模板文件
标签:cobbler
原文地址:http://neji1983.blog.51cto.com/3330124/1796997