CentOS6.4配置cobbler批量装机
部署环境
操作系统 :CentOS6.4 IP地址 :192.168.2.110 导入yum源 :rpm -Uvh http://mirrors.hustunique.com/epel/6/x86_64/epel-release-6-8.noarch.rpm 关闭iptables : service iptables stop;chkconfig iptables off 关闭selinux : setenforce 0;sed -i 's#SELINUX=enforcing#SELINUX=disabled#' /etc/sysconfig/selinux
安装
yum install -y cobbler cobbler-web dhcp httpd #如果使用现有网络中的DHCP,可以不安装dhcp服务 service httpd start service cobblerd start chkconfig cobblerd on chkconfig httpd on chkconfig dhcpd on
检查配置
#cobbler check
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.
解决办法:
sed -i "s#server: 127.0.0.1#server: 192.168.2.110#" /etc/cobbler/settings
-----------------------------------------------------------
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.
解决办法:
sed -i "s#next_server: 127.0.0.1#next_server: 192.168.2.110#" /etc/cobbler/settings
-----------------------------------------------------------
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
解决办法:
关闭selinux
-----------------------------------------------------------
4 : change 'disable' to 'no' in /etc/xinetd.d/tftp
解决办法:
vim /etc/xinetd.d/tftp
disable = no #yes改为no
-----------------------------------------------------------
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.
解决办法:
cobbler get-loaders 运行此命令,需要联网出现*** TASK COMPLETE *** 代表ok
-----------------------------------------------------------
6 : change 'disable' to 'no' in /etc/xinetd.d/rsync
解决办法:
vim /etc/xinetd.d/rsync
disable = no #yes改为no
-----------------------------------------------------------
7 : reposync is not installed, need for cobbler reposync, install/upgrade yum-utils?
解决办法:
忽略
-----------------------------------------------------------
8 : debmirror package is not installed, it will be required to manage debian deployments and repositories
解决办法:
yum install -y debmirror
-----------------------------------------------------------
9 : ksvalidator was not found, install pykickstart
解决办法:
yum install -y pykickstart
-----------------------------------------------------------
10 : 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
解决办法:
# openssl passwd -1 -salt "sellsa" "123456"
$1$sellsa$sTJi7XI8eS6lYe5O8F4Ae1
这个命令的用法,任意字符(sellsa)可以随便写,这个密码(123456)就是安装完系统root的密码了。替换配置文件里的字串。
vi /etc/cobbler/settings
default_password_crypted: "$1$sellsa$sTJi7XI8eS6lYe5O8F4Ae1"
-----------------------------------------------------------
11 : fencing tools were not found, and are required to use the (optional) power management features. install
cman or fence-agents to use them
解决办法:
yum install -y cman fence-agents
-----------------------------------------------------------
12 : comment out 'dists' on /etc/debmirror.conf for proper debian support
解决办法:
vim /etc/debmirror.conf
#@dists="sid"; 注释
-----------------------------------------------------------
13 : comment out 'arches' on /etc/debmirror.conf for proper debian support
解决办法:
vim /etc/debmirror.conf
#@arches="i386"; 注释
-----------------------------------------------------------
Restart cobblerd and then run 'cobbler sync' to apply changes.
#service cobblerd restart
#cobbler sync
配置修改
1、修改cobbler 的配置文件
#vi /etc/cobbler/settings
manage_dhcp: 1 #如果使用现有网络中的DHCP服务,可以不启用,设置0
manage_rsync: 1
2、启动tftp和rsync
/etc/init.d/xinetd restart
3、修改dhcp的配置文件 #如果使用现有网络中的DHCP服务,可以不配置此项
#vi /etc/cobbler/dhcp.template
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 192.168.2.0 netmask 255.255.255.0 {
option routers 192.168.1.254;
option domain-name-servers 8.8.8.8;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.2.150 192.168.2.200;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
filename "pxelinux.0";
}
#余下默认,只修改这个模板就行,cobbler 会同步到dhcp的配置
如果在现有的DHCP服务上配置,则需要
dhcp(Windows)
对应网段的作用域-->作用域选项-->右键配置选项-->高级-->066启动服务器主机名 设置为192.168.2.110
067启动文件名 设置为 pxelinux.0
dhcp(Linux)
在对应网段作用域内加入以下两行:next-server 192.168.3.253;
filename "pxelinux.0";
配置web环境
# vi /etc/cobbler/modules.conf module = authn_configfile #修改认证方式为密码文件类型 # htdigest /etc/cobbler/users.digest "Cobbler" cobbler #添加admin用户,提示输入2遍密码确认 Adding user cobbler in realm cobbler New password: Re-type new password: # cobbler sync /输出*** TASK COMPLETE *** 表示配置无错误 # service httpd restart # service cobblerd restart
访问web页面 https://192.168.2.110/cobbler_web #使用刚才创建的用户登录

添加DVD源
mkdir /media/cdrom mount /dev/cdrom /media/cdrom/ cobbler import --path=/media/cdrom --name=centos6.4
导入完成后可以看到

配置ks文件
#cd /var/lib/cobbler/kickstarts/
#cp default.ks centos6.4.ks
# vim centos6.4.ks
可根据实际需求修改
# this file intentionally left blank
# admins: edit it as you like, or leave it blank for non-interactive install
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --disable
# 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 Asia/Shanghai
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
#autopart
clearpart --all --initlabel
part /boot --fstype="ext4" --asprimary --size=200
part swap --fstype="swap" --size=4096
part / --fstype="ext4" --asprimary --grow --size=1
%packages
@base
git
xsettings-kde
-ibus-table-cangjie
-ibus-table-erbi
-ibus-table-wubi
%end
%post
#base ini configuration
配置Profile
Configuration-->Profile


客户端从网络启动

每天进步一点,加油!
浙公网安备 33010602011771号