Cobbler是一个快速网络安装linux和windows的服务,使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP、DNS、以及yum仓库、构造系统ISO镜像。
Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用。
Cobbler客户端Koan支持虚拟机安装和操作系统重新安装,使重装系统更便捷。
Cobbler提供以下服务集成:
* PXE服务支持
* DHCP服务管理
* DNS服务管理
* 电源管理
* Kickstart服务支持
* yum仓库管理
Cobbler最初是支持系统版本Fedora, Red Hat和衍生版本,如CentOS 和Scientific Linux.现在对Debian 和Ubuntu SuSE支持也相当强。还支持FreeBSD、ESXI等。
koan 在Fedora, Red Hat Enterprise Linux, or CentOS工作正常,其他Linux版本应该也不错。
Cobbler工作流程:
默认的光盘中没有cobbler软件,必须在yum仓库中设置第三方的软件源,才能安装cobbler等软件。这里用的epel软件源
什么是epel
EPEL(http://fedoraproject.org/wiki/EPEL) 是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。
CentOS 5 i386:
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
CentOS 5 x86_64
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
CentOS 6 i386:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
CentOS 6 x86_64:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
yum -y install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes
sed -i 's/next_server: 127.0.0.1/next_server: 192.168.5.101/g' /etc/cobbler/settings
sed -i 's/server: 127.0.0.1/server: 192.168.5.101/g' /etc/cobbler/settings sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings
/etc/cobbler/settings #Cobbler主配置文件
配置前后内容对比
diff /etc/cobbler/settings /etc/cobbler/settings_2013-10-17
218c218
< manage_dhcp: 1 #启用cobbler管理DHCP功能
---
> manage_dhcp: 0
237c237
< manage_rsync: 1 #启用cobbler管理rsync功能
---
> manage_rsync: 0
248c248
< next_server: 192.168.5.101 # DHCP服务地址
---
> next_server: 127.0.0.1
360c360
< server: 192.168.5.101 # cobbler服务地址
---
> server: 127.0.0.1
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
chkconfig ip6tables off
chkconfig iptables off
/etc/init.d/ip6tables stop
/etc/init.d/iptables stop
设置 'disable' 为 'no'
sed -i '/disable/c\\tdisable\t\t\t= no' /etc/xinetd.d/tftp
sed -i 's/\=\ yes/\=\ no/g' /etc/xinetd.d/rsync
sed -i 's@#LoadModule@LoadModule@g' /etc/httpd/conf.d/wsgi.conf
这里生成密钥和配置默认密钥,ks文件引用
openssl passwd -1 -salt 'random-phrase-here' '123456'
$1$random-p$mzxQ/Sx848sXgvfwJCoZM0
加入cobbler配置
vim /etc/cobbler/settings
grep default_password_crypted /etc/cobbler/settings
default_password_crypted: "$1$random-p$mzxQ/Sx848sXgvfwJCoZM0"
cp /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.$(date +%F) #备份
vim /etc/cobbler/dhcp.template
ddns-update-style interim;
allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
subnet 192.168.5.0 netmask 255.255.255.0 {
option routers 192.168.5.1;
option domain-name-servers 202.106.0.20;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.5.180 192.168.5.200;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
/sbin/service httpd start
/sbin/service dhcpd start
/sbin/service xinetd start
/sbin/service cobblerd start
/sbin/chkconfig httpd on
/sbin/chkconfig dhcpd on
/sbin/chkconfig xinetd on
/sbin/chkconfig tftp on
/sbin/chkconfig cobblerd on
cobbler get-loaders
yum -y install debmirror
修改 /etc/debmirror.conf 配置文件,注释掉 @dists 和 @arches 两行
sed -i 's|@dists=.*|#@dists=|' /etc/debmirror.conf
sed -i 's|@arches=.*|#@arches=|' /etc/debmirror.conf
cobbler check
configuration problems found. All systems go. #出现此提示即正常
cobblerd does not appear to be running/accessible #此提示是因为cobbler服务没启动
cobbler check出现的相关报错处理看下面步骤
cobbler sync
命令名称 |
命令用途 |
cobbler check |
检查cobbler配置 |
cobbler list |
列出所有的cobbler元素 |
cobbler report |
列出元素的详细信息 |
cobbler distro |
查看导入的发行版系统信息 |
cobbler system |
查看添加的系统信息 |
cobbler profile |
查看配置信息 |
cobbler sync |
同步Cobbler配置,更改配置最好都要执行下 |
cobbler reposync |
同步yum仓库 |
命令参考
cobbler --help
cobbler distro --help
cobbler distro add --help
Cobbler配置文件存放在/etc/cobbler下
配置文件名称 |
作 用 |
/etc/cobbler/settings |
Cobbler主配置文件 |
/etc/cobbler/users.digest |
用于web访问的用户名密码配置文件 |
/etc/cobbler/modules.conf |
模块配置文件 |
/etc/cobbler/users.conf |
Cobbler WebUI/Web 服务授权配置文件 |
/etc/cobbler/iso/ |
Buildiso 模板配置文件 |
/etc/cobbler/power |
电源配置文件 |
/etc/cobbler/pxe |
Pxeprofile配置模板 |
/etc/cobbler |
此目录也包含rsync、dhcp、dns、pxe、dnsmasq等服务的模板配置文件 |
导入的系统发行版,repos镜像和kickstart文件都放置在/var/www/cobbler目录下。确保/var目录有足够的空间来存储这些文件。
目录名称 |
作 用 |
/var/www/cobbler/images/ |
存储所有导入发行版的Kernel和initrd镜像用于远程网络启动 |
/var/www/cobbler/ks_mirror/ |
存储导入的发行版系统数据 |
/var/www/cobbler/repo_mirror/ |
仓库存储目录 |
/var/log/cobbler |
Cobbler日志文件 cobbler.log install.log |
此目录存储和Cobbler profiles、systems、distros相关的配置。
目录名称 |
作 用 |
/var/lib/cobbler/config/ |
存放distros、repos、systems和profiles等信息配置文件,一般都是json文件 |
/var/lib/cobbler/snippets/ |
存放ks文件可以导入的脚本小片段,值得研究 |
/var/lib/cobbler/triggers |
存放用户定义的cobbler 命令 |
/var/lib/cobbler/kickstarts/ |
存放kickstart配置文件 |
web日志存放点
/var/log/httpd/access_log
/var/log/httpd/error_log
/var/log/httpd/ssl_access_log
/var/log/httpd/ssl_error_log
Cobbler日志
/var/log/cobbler/cobbler.log
/var/log/cobbler/install.log
通过Cobbler日志可以获取系统的安装状态
注意下载的ISO文件要核对文件的md5值,确保数据完整性
md5sum CentOS-5.8-x86_64-bin-DVD-1of2.iso
8a3bf0030f192022943f83fe6b2cf373 CentOS-5.8-x86_64-bin-DVD-1of2.iso
mkdir -p /var/iso/Linux/Centos/x86_64/
mkdir -p /var/os/Linux/Centos/x86_64/Centos5.8/dvd
mkdir -p /var/os/Linux/Centos/x86_64/Centos6.3/dvd
mkdir -p /var/os/Linux/Centos/x86_64/Centos6.4/dvd
mount -o loop /var/iso/Linux/Centos/x86_64/CentOS-5.8-x86_64-bin-DVD-1of2.iso /var/os/Linux/Centos/x86_64/Centos5.8/dvd
系统版本命名为centos5.8 架构x86_64,这时间长,耐性等待。可查看ls /var/www/cobbler/ks_mirror/centos5.8-x86_64/目录文件生成情况。
cobbler import --path=/var/os/Linux/Centos/x86_64/Centos5.8/dvd --name=centos5.8 --arch=x86_64
cobbler list
distros:
centos5.8-x86_64
centos5.8-xen-x86_64
centos6.3-x86_64
centos6.4-x86_64
profiles:
centos5.8-x86_64
centos5.8-xen-x86_64
centos6.3-x86_64
centos6.4-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:
列出详细信息可以使用cobbler report
du -sh /var/www/cobbler/ks_mirror/centos5.8-x86_64/
4.1G /var/www/cobbler/ks_mirror/centos5.8-x86_64/
du -sh /var/os/Linux/Centos/x86_64/Centos5.8/dvd/
4.3G /var/os/Linux/Centos/x86_64/Centos5.8/dvd/
CentOS6.3
mount -o loop /var/iso/Linux/Centos/x86_64/CentOS-6.3-x86_64-bin-DVD1.iso /var/os/Linux/Centos/x86_64/Centos6.3/dvd/
cobbler import --path=/var/os/Linux/Centos/x86_64/Centos6.3/dvd/ --name=centos6.3 --arch=x86_64
CentOS6.4
mount -o loop /var/iso/Linux/Centos/x86_64/CentOS-6.4-x86_64-bin-DVD1.iso /var/os/Linux/Centos/x86_64/Centos6.4/dvd/
cobbler import --path=/var/os/Linux/Centos/x86_64/Centos6.4/dvd/ --name=centos6.4 --arch=x86_64
cobbler profile find --distro=centos6.3-x64-x86_64 #查看配置是否存在
centos6.3-x64-x86_64
cobbler profile remove --name=centos6.3-x64-x86_64 #删除配置文件
cobbler distro remove --name=centos6.3-x64-x86_64 #删除distro
cobbler profile find --distro=centos6.3-x64-x86_64 #再查看配置已无
更改kickstart文件,可为http等,具体cobbler --help查看,这里采用自定制ks文件
ks目录位置
/var/lib/cobbler/kickstarts/
默认的ks位置
/var/lib/cobbler/kickstarts/sample.ks
更改指定系统版本对应的ks配置文件
cobbler profile edit --name=centos5.8-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos5u8-x64.cfg
cobbler profile edit --name=centos6.3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6u3-x64.cfg
cobbler profile edit --name=centos6.4-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6u4-x64.cfg
cobbler report
cobbler distro list
建议先执行cobbler check进行配置检查再执行cobbler sync,修改cobbler配置后都需要执行此步骤
cobbler check
No configuration problems found. All systems go.
cobbler sync
task started: 2013-03-12_171702_sync
task started (id=Sync, time=Tue Mar 12 17:17:02 2013)
running pre-sync triggers
cleaning trees
……略……
rendering Rsync files
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout:
received on stderr:
running: service dhcpd restart
received on stdout: Shutting down dhcpd: [ OK ]
Starting dhcpd: [ 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_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
增加装机安全设置菜单密码
生成hash密码
支持两种不同类型的密码:
sha1pass mypassword
或
openssl passwd -1 -salt sXiKzkus mypassword
这里选择后者
# openssl passwd -1 -salt sXiKzkus 密码
编辑配置文件pxedefault,添加如下红色部分
vim /etc/cobbler/pxe/pxedefault.template
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://fedorahosted.org/cobbler
MENU MASTER PASSWD $1$sXiKzkus$2DoZ6pfTe8rrc0Si60ecB/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT $pxe_timeout_profile
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
$pxe_menu_items
MENU end
配置pxeprofile,增加红色部分
vim /etc/cobbler/pxe/pxeprofile.template
LABEL $profile_name
MENU PASSWD
kernel $kernel_path
$menu_label
$append_line
ipappend 2
修改完毕注意检查、同步配置使其生效
cobbler check
cobbler sync
PXE装机时选择装机系统版本,输入装机密码,效果图
编辑pxedefault文件,
vim /etc/cobbler/pxe/pxedefault.template
MENU TITLE Cobbler | http://fedorahosted.org/cobbler
将原文上面的内容根据自定义进行修改
MENU TITLE Centos Automation Install System
修改后的文件
DEFAULT menu
PROMPT 0
MENU TITLE Centos Automation Install System
MENU MASTER PASSWD $1$sXiKzkus$2DoZ6pfTe8rrc0Si60ecB/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT $pxe_timeout_profile
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
$pxe_menu_items
MENU end
修改完毕执行如下两条命令
cobbler check
cobbler sync
cobbler system add --name=network --ip=172.17.188.0/16 --profile=centos5.8-x86_64
指定服务器就是绑定它的mac地址,并设置好ip、dns、hostname
定义系统
cobbler system add --name=host-188116 --hostname=host-188116 --mac=00:19:B9:E5:34:FE --interface=eth0 --ip-address=172.17.188.116 --subnet=255.255.0.0 --gateway=172.17.188.1 --static=1 --profile=centos5.8-x86_64
查看定义的系统列表
cobbler system list
host-188116
更多参数见cobbler system add --help
导入完毕后,进行下面的步骤
base、updates库使用163的repo源并增加EPEL库
base
cobbler repo add --name=centos5.8-x86_64-Base --mirror=http://mirrors.163.com/centos/5/os/x86_64/
将定义的仓库大写名字Base修改为小写base
cobbler repo edit --name=centos5.8-x86_64-base --mirror=http://mirrors.163.com/centos/5/os/x86_64/ --arch=x86_64 --breed=yum
updates
cobbler repo add --name=centos5.8-x86_64-updates --mirror=http://mirrors.163.com/centos/5/updates/x86_64/ --arch=x86_64 --breed=yum
添加EPEL仓库
cobbler repo add --name=centos5.8-x86_64-epel --mirror=http://mirrors.ustc.edu.cn/epel/5/x86_64/ --arch=x86_64 --breed=yum
时间较长,注意磁盘容量是否满足。
cobbler reposync
task started: 2013-03-26_111553_reposync
task started (id=Reposync, time=Tue Mar 26 11:15:53 2013)
hello, reposync
run, reposync, run!
creating: /var/www/cobbler/repo_mirror/centos5.8-x86_64-updates/.origin/centos5.8-x86_64-updates.repo
running: /usr/bin/reposync -l -m -d --config=/var/www/cobbler/repo_mirror/centos5.8-x86_64-updates/.origin/centos5.8-x86_64-updates.repo --repoid=centos5.8-x86_64-updates --download_path=/var/www/cobbler/repo_mirror -a x86_64
………………略…………………………
received on stdout:
received on stderr:
*** TASK COMPLETE ***
安装系统时会自动添加仓库配置
cobbler profile edit --name=centos5.8-x86_64 --repos="centos5.8-x86_64-base centos5.8-x86_64-epel centos5.8-x86_64-updates" --distro=centos5.8-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos5u8-x64.cfg
删除仓库配置
cobbler repo remove --name=centos5.8-x86_64- updates
cobbler reposync --tries=3 --no-fail
加入crontab 每周日更新一次即可
echo "0 2 * * 0 cobbler reposync --tries=3 --no-fail" >> /var/spool/cron/root
注意检查crond是否启动
/etc/init.d/crond status
crond is stopped
/etc/init.d/crond start
chkconfig crond on
如果想安装系统时自动配置yum,请进行以下配置。
vim /etc/cobbler/settings
yum_post_install_mirror: 1
在装机脚本ks文件加入以下内容
%post
# Start yum configuration
$yum_config_stanza
# End yum configuration
下面的参数PXE安装系统是会引用添加的cobbler repo配置
注意可能将系统、应用部署到较新版本,根据情况而配置
$yum_repo_stanza
这两个参数都来自Kickstart snippets,很值得研究https://github.com/cobbler/cobbler/wiki/Kickstart-snippets
系统安装自动配置的yum
cat /etc/yum.repos.d/cobbler-config.repo
[core-0]
name=core-0
baseurl=http://192.168.5.101/cobbler/ks_mirror/centos5.8-x86_64
enabled=1
gpgcheck=0
priority=1
[centos5.8-x86_64-base]
name=centos5.8-x86_64-base
baseurl=http://192.168.5.101/cobbler/repo_mirror/centos5.8-x86_64-base
enabled=1
priority=99
gpgcheck=0
[centos5.8-x86_64-epel]
name=centos5.8-x86_64-epel
baseurl=http://192.168.5.101/cobbler/repo_mirror/centos5.8-x86_64-epel
enabled=1
priority=99
gpgcheck=0
[centos5.8-x86_64-updates]
name=centos5.8-x86_64-updates
baseurl=http://192.168.5.101/cobbler/repo_mirror/centos5.8-x86_64-updates
enabled=1
priority=99
gpgcheck=0
这个密码 $default_password_crypted 就是步骤3.6使用openssl passwd -1 生成的密码
grep rootpw /var/lib/cobbler/kickstarts/sample.ks
rootpw --iscrypted $default_password_crypted
默认菜单文件内容
cat /tftpboot/pxelinux.cfg/default
DEFAULT menu
PROMPT 0
MENU TITLE Centos Automation Install System
TIMEOUT 150
TOTALTIMEOUT 6000
ONTIMEOUT local
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
LABEL centos5.8-x86_64
kernel /images/centos5.8-x86_64/vmlinuz
MENU LABEL centos5.8-x86_64
append initrd=/images/centos5.8-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.5.101/cblr/svc/op/
ks/profile/centos5.8-x86_64
ipappend 2
指定系统的菜单文件内容
cat /tftpboot/pxelinux.cfg/01-00-19-b9-e5-34-fe
default linux
prompt 0
timeout 1
label linux
kernel /images/centos5.8-x86_64/vmlinuz
ipappend 2
append initrd=/images/centos5.8-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.5.101/cblr/svc/op/ks/system/host-188116
将需要安装系统的服务器网卡启用PXE,启动服务器从PXE引导
默认从本地硬盘引导,可以修改,建议还是保持此默认。
选择安装系统centos5.8 即可自动安装系统
Tab键,可以对启动项参数进行编辑
安装源数据说明:
系统centos5.8-x86_64的安装系统数据源,其他系统同理
链接
https://url/cblr/links/centos5.8-x86_64/
目录
/var/www/cobbler/links/centos5.8-x86_64/
是一个链接目录,实际位置如下
ll links/
total 0
lrwxrwxrwx 1 root root 43 Mar 12 13:41 centos5.8-x86_64 -> /var/www/cobbler/ks_mirror/centos5.8-x86_64
koan是cobbler的一个辅助工具,koan是kickstart-over-a-network的缩写安装在客户端的使用,koan配合cobbler实现快速重装linux。
koan 在Fedora, Red Hat Enterprise Linux, 和 CentOS工作正常,其他Linux版本应该也不错
koan的相关脚本在此目录内/usr/lib/python2.4/site-packages/koan/
通过EPEL安装的koan版本为koan-2.2.3-2.el5,使用中报错较多,此版本比较稳定koan-1.6.6-1.el5,下载链接ftp://rpmfind.net/linux/epel/5/i386/koan-1.6.6-1.el5.noarch.rpm
关于Koan更多内容见https://github.com/cobbler/cobbler/wiki/Koan
在重装的机器上安装koan
Rpm -ivh koan-1.6.6-1.el5.noarch.rpm
koan --server=192.168.5.101 --list=profiles
- looking for Cobbler at http://192.168.5.101:80/cobbler_api
centos5.8-xen-x86_64
centos6.4-x86_64
centos5.8-x86_64
centos6.3-x86_64
koan --server=192.168.5.101 --list=systems
- looking for Cobbler at http://192.168.5.101/cobbler_api
host-188116
koan --server=192.168.5.101 --list=images
koan --server=192.168.5.101 --display --profile=centos5.8-x86_64
- looking for Cobbler at http://192.168.5.101:80/cobbler_api
- reading URL: http://192.168.5.101/cblr/svc/op/ks/profile/centos5.8-x86_64
install_tree: http://192.168.5.101/cblr/links/centos5.8-x86_64
name : centos5.8-x86_64
distro : centos5.8-x86_64
kickstart : http://192.168.5.101/cblr/svc/op/ks/profile/centos5.8-x86_64
ks_meta : tree=http://@@http_server@@/cblr/links/centos5.8-x86_64
install_tree : http://192.168.5.101/cblr/links/centos5.8-x86_64
kernel : /var/www/cobbler/ks_mirror/centos5.8-x86_64/images/pxeboot/vmlinuz
initrd : /var/www/cobbler/ks_mirror/centos5.8-x86_64/images/pxeboot/initrd.img
kernel_options : ks=http://192.168.5.101/cblr/svc/op/ks/profile/centos5.8-x86_64 ksdevice=link kssendmac
repos : centos5.8-x86_64-base centos5.8-x86_64-epel centos5.8-x86_64-updates
virt_ram : 512
virt_disk_driver : raw
virt_type : qemu
virt_path :
virt_auto_boot : 1
koan --server=192.168.5.101 --display --system=host-188116
- looking for Cobbler at http://192.168.5.101/cobbler_api
- reading URL: http://192.168.5.101/cblr/svc/op/ks/system/host-188116
install_tree: http://192.168.5.101/cblr/links/centos5.8-x86_64
name : host-188116
distro : centos5.8-x86_64
profile : centos5.8-x86_64
kickstart : http://192.168.5.101/cblr/svc/op/ks/system/host-188116
ks_meta : tree=http://@@http_server@@/cblr/links/centos5.8-x86_64
install_tree : http://192.168.5.101/cblr/links/centos5.8-x86_64
kernel : /var/www/cobbler/ks_mirror/centos5.8-x86_64/images/pxeboot/vmlinuz
initrd : /var/www/cobbler/ks_mirror/centos5.8-x86_64/images/pxeboot/initrd.img
kernel_options : ks=http://192.168.5.101/cblr/svc/op/ks/system/host-188116 ksdevice=link kssendmac
repos : centos5.8-x86_64-base centos5.8-x86_64-epel centos5.8-x86_64-updates
virt_ram : 512
virt_type : qemu
virt_path :
koan --server=192.168.5.101 --display --system=host-188116
- looking for Cobbler at http://192.168.5.101/cobbler_api
- reading URL: http://192.168.5.101/cblr/svc/op/ks/system/host-188116
install_tree: http://192.168.5.101/cblr/links/centos5.8-x86_64
name : host-188116
distro : centos5.8-x86_64
profile : centos5.8-x86_64
kickstart : http://192.168.5.101/cblr/svc/op/ks/system/host-188116
ks_meta : tree=http://@@http_server@@/cblr/links/centos5.8-x86_64
install_tree : http://192.168.5.101/cblr/links/centos5.8-x86_64
kernel : /var/www/cobbler/ks_mirror/centos5.8-x86_64/images/pxeboot/vmlinuz
initrd : /var/www/cobbler/ks_mirror/centos5.8-x86_64/images/pxeboot/initrd.img
kernel_options : ks=http://192.168.5.101/cblr/svc/op/ks/system/host-188116 ksdevice=link kssendmac
repos : centos5.8-x86_64-base centos5.8-x86_64-epel centos5.8-x86_64-updates
virt_ram : 512
virt_type : qemu
virt_path :
koan --server=192.168.5.101 --display --image=name
koan -r --server=192.168.5.101 --profile=centos5.8-x86_64
- looking for Cobbler at http://192.168.5.101:80/cobbler_api
- reading URL: http://192.168.5.101/cblr/svc/op/ks/profile/centos5.8-x86_64
install_tree: http://192.168.5.101/cblr/links/centos5.8-x86_64
downloading initrd initrd.img to /boot/initrd.img_koan
url=http://192.168.5.101/cobbler/images/centos5.8-x86_64/initrd.img
- reading URL: http://192.168.5.101/cobbler/images/centos5.8-x86_64/initrd.img
downloading kernel vmlinuz to /boot/vmlinuz_koan
url=http://192.168.5.101/cobbler/images/centos5.8-x86_64/vmlinuz
- reading URL: http://192.168.5.101/cobbler/images/centos5.8-x86_64/vmlinuz
- ['/sbin/grubby', '--add-kernel', '/boot/vmlinuz_koan', '--initrd', '/boot/initrd.img_koan', '--args', '"ks=http://192.168.5.101/cblr/svc/op/ks/profile/centos5.8-x86_64 ksdevice=link kssendmac "', '--copy-default', '--make-default', '--title=kick1364289618']
- reboot to apply changes
注意:输入此命令重启后,不能再中止重装,重启后自动进入pxe装机。
reboot
执行reboot命令重启服务器后,客户端服务器会自动重新安装操作系统,无需人工干预
步骤3.11已经添加指定客户机配置,在这里使用配置为指定的服务器安装操作系统
koan -r --server=192.168.5.101 --system=host-188116
- looking for Cobbler at http://192.168.5.101/cobbler_api
- reading URL: http://192.168.5.101/cblr/svc/op/ks/system/host-188116
install_tree: http://192.168.5.101/cblr/links/centos5.8-x86_64
downloading initrd initrd.img to /boot/initrd.img
url=http://192.168.5.101/cobbler/images/centos5.8-x86_64/initrd.img
- reading URL: http://192.168.5.101/cobbler/images/centos5.8-x86_64/initrd.img
downloading kernel vmlinuz to /boot/vmlinuz
url=http://192.168.5.101/cobbler/images/centos5.8-x86_64/vmlinuz
- reading URL: http://192.168.5.101/cobbler/images/centos5.8-x86_64/vmlinuz
- ['/sbin/grubby', '--add-kernel', '/boot/vmlinuz', '--initrd', '/boot/initrd.img', '--args', '"ks=http://192.168.5.101/cblr/svc/op/ks/system/host-188116 ksdevice=link kssendmac "', '--copy-default', '--make-default', '--title= kick1364390697']
- reboot to apply changes
[root@host-d-116 ~]# reboot
系统重启看到kick1364390697与上面命令生成的相同,重装过程同上
Cobbler web界面是一个很好的前端,非常容易管理Cobbler
可以添加和删除 system distro profile
可以查看、编辑distros, profiles, subprofiles, systems, repos 、 kickstart文件
yum -y install cobbler-web
为已存在的用户cobbler重置密码
htdigest /etc/cobbler/users.digest "Cobbler" cobbler
添加新用户
htdigest /etc/cobbler/users.digest "Cobbler" your_newname
sed -i 's/authn_denyall/authn_configfile/g' /etc/cobbler/modules.conf
/etc/init.d/cobblerd restart
/etc/init.d/httpd restart
浏览器访问登录页面https://192.168.5.101/cobbler_web
输入用户名密码
登录后的页面