一、安装与配置cobbler:
1、导入epel源:由于互联网上的6.5版本已经没有办法下载了,我用的最新版本:epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
# yum update
# yum upgrade
2、安装cobbler:
# yum install cobbler
3、修改配置:
# vi /etc/cobbler/settings , 一共修改三处如下
next_server: 192.168.1.100 #IP of Cobbler server
server: 192.168.1.100 #IP of Cobbler server
manage_dhcp: 1 #让cobbler管理DHCP
4、启动httpd和xinetd、cobbler:
# /etc/init.d/httpd start
# /etc/init.d/xinetd start
# /etc/init.d/cobblerd start (先禁用selinux)
# chkconfig httpd on
# chkconfig xinetd on
# chkconfig cobblerd on
5、修改 rsync 和 tftp 这两个服务的 xinetd 配置:
vi /etc/xinetd.d/rsync 修改部分: disable = no
vi /etc/xinetd.d/tftp 修改部分: disable = no
6、关闭防火墙和selinux,并重启:
# /etc/init.d/iptables stop
# chkconfig iptables off
# vi /etc/sysconfig/selinux 修改部分:SELINUX=disabled
# reboot
7、安装cobbler loaders:
cobbler get-loaders
8、生成密码的hash值,这个用于构造系统的默认密码:
openssl passwd -1 -salt ‘since’ ‘since2014’
生成的hash值:$1$$05Gidn0z8BjDu2ZbV4fS.0
9、编辑 /etc/cobbler/settings
default_password_crypted: “$1$$05Gidn0z8BjDu2ZbV4fS.0” 上面生成的hash值。
二、检查和修改cobbler配置:
1、修改dhcp文件/etc/cobbler/dhcp.template:
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.254;
option domain-name-servers 192.168.1.100;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.1.101 192.168.1.130;
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";
}
}
}
2、导入镜像文件,如放在/root/CentOS-6.0-x86_64-bin-DVD1.iso
mount -o loop /root/CentOS-6.0-x86_64-bin-DVD1.iso /mnt/
cobbler import --path=/mnt/ --name=cent60-x86_64
3、重启和同步cobbler:
/etc/init.d/cobblerd restart
cobbler sync
4、到这布已经配置完成:
可以使用如下两个命令检查配置: cobbler list或者cobbler report
cobbler report
distros:
==========
Name : cent60-x86_64
Architecture : x86_64
TFTP Boot Files : {}
Breed : redhat
Comment :
Fetchable Files : {}
Initrd : /var/www/cobbler/ks_mirror/cent60-x86_64/p_w_picpaths/pxeboot/initrd.img
Kernel : /var/www/cobbler/ks_mirror/cent60-x86_64/p_w_picpaths/pxeboot/vmlinuz
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/cent60-x86_64'}
Management Classes : []
OS Version : rhel6
Owners : ['admin']
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Template Files : {}
profiles:
==========
Name : cent60-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : cent60-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 #这是使用的ks文件,可以自定义。
Kickstart Metadata : {}
Management Classes : []
Management Parameters : <<inherit>>
Name Servers : []
Name Servers Search Path : []
Owners : ['admin']
Parent Profile :
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
systems:
==========
repos:
==========
p_w_picpaths:
==========
mgmtclasses:
==========
packages:
==========
files:
==========
5、最后客户端采用PXE引动服务器就ok了
三、附录:
1、ks文件:
# kickstart template for Fedora 8 and later.
# (includes %end blocks)
# do not use with earlier distros
#platform=x86, AMD64, or Intel EM64T
# 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 --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 Asia/Shanghai
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
#autopart
part /boot --fstype="ext4" --size=200
part swap --fstype="swap" --size=9000
part / --fstype="ext4" --grow --size=1
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end
%packages
$SNIPPET('func_install_if_enabled')
@additional-devel
@backup-client
@backup-server
@base
@basic-desktop
@cifs-file-server
@compat-libraries
@console-internet
@debugging
@desktop-debugging
@desktop-platform
@desktop-platform-devel
@development
@dial-up
@directory-client
@directory-server
@eclipse
@emacs
@fonts
@ftp-server
@general-desktop
@graphical-admin-tools
@graphics
@hardware-monitoring
@infiniband
@input-methods
@internet-applications
@internet-browser
@java-platform
@kde-desktop
@large-systems
@legacy-unix
@legacy-x
@mainframe-access
@mysql
@mysql-client
@network-file-system-client
@network-tools
@nfs-file-server
@office-suite
@performance
@perl-runtime
@php
@postgresql
@postgresql-client
@remote-desktop-clients
@scalable-file-systems
@scientific
@security-tools
@server-platform-devel
@smart-card
@storage-client-fcoe
@storage-client-multipath
@system-management
@system-management-messaging-client
@system-management-snmp
@system-management-wbem
@technical-writing
@tex
@turbogears
@web-server
@web-servlet
@x11
%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
2、cobbler check常见的错误:摘自互联网(由于我安装的时候未出现这样的问题,所以摘录防止以后遇到这样的错误)
# cobbler check
这是cobbler自带的检测命令,提供cobbler必须的一些设置的检查,运行之后根据不同的环境,检测出来的结果也是不同的,不过所有的检测中我们都可以按照他的提示,一步步的来完善配置。
我们这里运行之后发现如下的错误:
The following are potential configuration items that you may want to fix:
1: 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.
2 : ksvalidator was not found, install pykickstart
3 : debmirror package is not installed, it will be required to manage debian deployments and repositories
4 : 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
5 : 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.
我们一个个来解决:
修复问题1:
# cobbler get-loader
即可获取各ios的bootloader
修复问题2:
安装ksvalidator
# yum install pykickstart
修复问题3:
cobbler服务器能同时部署CentOS/Fedora/Debian/Ubuntu系统,所以需要安装debmirror,安装debmirror-20090807-1.el5.noarch.rpm,在此之前,需要先安装一些其他的依赖包:
# yum install ed patch perl perl-Compress-Zlib perl-Cwd perl-Digest-MD5 perl-Digest-SHA1 perl-LockFile-Simple perl-libwww-perl
# wget ftp://fr2.rpmfind.net/linux/epel/5/ppc/debmirror-20090807-1.el5.noarch.rpm
# rpm –ivh debmirror-20090807-1.el5.noarch.rpm
修改/etc/debmirror.conf 配置文件,注释掉 @dists 和 @arches 两行
# vim /etc/debmirror.conf
…
#@dists=”sid”;
@sections=”main,main/debian-installer,contrib,non-free”;
#@arches=”i386″;
…
修复问题4:
修改默认系统密码用 openssl 生成一串密码后加入到 cobbler 的配置文件(/etc/cobbler/settings)里,替换 default_password_crypted 字段:
# openssl passwd -1 -salt ‘bihan’ ‘Abcd1234′
$1$bihan$9ZUK/6ZK0WPa/L5/9UHgj1
# vi /etc/cobbler/settings
修改内容如下:
default_password_crypted: “$1$bihan$9ZUK/6ZK0WPa/L5/9UHgj1″
修复问题5:
这属于电源管理的选项,根据提示安装cman即可。
# yum install cman
所有修复都结束之后,重新运行 cobbler check 检查一下,之后,运行cobbler sync来同步配置信息,如果没有发现问题,应该显示是这样的:
# cobbler check
No configuration problems found. All systems go.
转载于:https://blog.51cto.com/yedee/1528502