Chinaunix首页 | 论坛 | 博客
  • 博客访问: 242675
  • 博文数量: 49
  • 博客积分: 1035
  • 博客等级: 少尉
  • 技术积分: 477
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-14 17:23
文章分类

全部博文(49)

文章存档

2015年(15)

2014年(6)

2011年(1)

2008年(3)

2007年(11)

2006年(13)

我的朋友

分类: 系统运维

2015-03-27 11:20:45

1. 安装Cobbler

安装很简单。Cobbler 不在 CentOS 6 的基本源中,需要导入 EPEL 源:

wget
rpm -Uvh epel-release-6-8.noarch.rpm
yum install cobbler tftp-server dhcp xinetd

2. 配置cobbler

修改配置,主要修改 cobbler 服务器所在的 IP 地址:

2.1  vi /etc/cobbler/settings

...
next_server: 192.168.1.2 #IP of Cobbler server
server: 192.168.1.2 #IP of Cobbler server
...

2.2 启用 httpd, xinetd 和 cobbler 服务并确认已经加到系统自动启动服务中:

/etc/init.d/httpd start
/etc/init.d/xinetd start
/etc/init.d/cobblerd start
chkconfig httpd on
chkconfig xinetd on
chkconfig cobblerd on

2.3 修改 rsync 和 tftp 这两个服务的 xinetd 配置:

# vi /etc/xinetd.d/rsync
service rsyncnp
{
        disable = no
...
}
# vi /etc/xinetd.d/tftp
service tftp
{
        ...
        disable = no
        ...
}

2.4 关闭防火墙和 SELinux 后重启系统:


# /etc/init.d/iptables stop
# chkconfig iptables off

# vi /etc/sysconfig/selinux
...
SELINUX=disabled
...

# reboot

2.5 检查cobbler配置情况     

#cobbler check
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 : change 'disable' to 'no' in /etc/xinetd.d/rsync
3 : since iptables may be running, ensure 69, 80/443, and 25151 are unblocked
4 : debmirror package is not installed, it will be required to manage debian deployments and repositories
5 : ksvalidator was not found, install pykickstart
6 : 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
7 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

2.6 生成配置

#cobbler get-loaders
task started: 2013-01-17_155601_get_loaders
task started (id=Download Bootloader Content, time=Thu Jan 17 15:56:01 2013)
downloading to /var/lib/cobbler/loaders/README
downloading to /var/lib/cobbler/loaders/COPYING.elilo
downloading to /var/lib/cobbler/loaders/COPYING.yaboot
downloading to /var/lib/cobbler/loaders/COPYING.syslinux
downloading to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading to /var/lib/cobbler/loaders/yaboot
downloading to /var/lib/cobbler/loaders/pxelinux.0
downloading to /var/lib/cobbler/loaders/menu.c32
downloading to /var/lib/cobbler/loaders/grub-x86.efi
downloading to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***

2.7 安装 debmirror

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/x86_64/debmirror-20090807-1.el5.noarch.rpm
rpm -ivh debmirror-20090807-1.el5.noarch.rpm
vim /etc/debmirror.conf,注销下面两行
#@dists="sid";
@sections="main,main/debian-installer,contrib,non-free";
#@arches="i386";

2.8 生成密码

openssl passwd -1 -salt "mytest.test.com" "testtesttest"
将结果添入配置文件中
# vi /etc/cobbler/settings
default_password_crypted: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

2.9 安装pykickstart和cman

yum install pykickstart cman

2.10 重启cobblerd

service cobblerd restart

2.11 同步相关cobbler的配置

# cobbler sync
task started: 2013-01-03_131724_sync
task started (id=Sync, time=Thu Jan  3 13:17:24 2013)
running pre-sync triggers
cleaning trees
mkdir: /var/lib/tftpboot/pxelinux.cfg
mkdir: /var/lib/tftpboot/grub
mkdir: /var/lib/tftpboot/s390x
mkdir: /var/lib/tftpboot/ppc
mkdir: /var/lib/tftpboot/etc
removing: /var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
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 ***

2.12 导入iso安装镜像

cobbler import --path=/mnt/test/ --name=Centos-6.3-x86_64-bin --arch=x86_64

3. 配置web

yum install cobbler-web

Cobbler web界面访问地址:

  (192.168.1.2为Cobbler web server地址)

设置用户名密码:
为已存在的用户重置密码:
htdigest /etc/cobbler/users.digest "Cobbler" cobbler
添加新用户:
htdigest /etc/cobbler/users.digest "Cobbler" yourname

设置/etc/cobbler/modules如下:
[authentication]  
module = authn_configfile  
[authorization]  
module = authz_allowall   

重启Cobbler服务:
service cobblerd restart

阅读(826) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~