自动化工具cobbler批量安装Centos6.0系统

一、安装与配置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/images/pxeboot/initrd.img

Kernel : /var/www/cobbler/ks_mirror/cent60-x86_64/images/pxeboot/vmlinuz

Kernel Options : {}

Kernel Options (Post Install) : {}

Kickstart Metadata : {‘tree‘: ‘http://@@[email protected]@/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:

==========

images:

==========

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.

   

时间: 2024-10-17 22:39:46

自动化工具cobbler批量安装Centos6.0系统的相关文章

运维自动化工具Cobbler之——安装实践

运维自动化工具--Cobbler实践 第1章 About Cobbler 1.1 Cobbler Introduction Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装.重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等. Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用.Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web

Cobbler实现自动化无人值守网络批量安装部署Linux系统

一.Cobbler(直译为补鞋匠) 使用 Cobbler,您无需进行人工干预即可安装机器.Cobbler 设置一个 PXE 引导环境(它还可使用 yaboot 支持 PowerPC),并控制与安装相关的所有方面,比如网络引导服务(DHCP 和 TFTP)与存储库镜像.当希望安装一台新机器时,Cobbler 可以: 1.使用一个以前定义的模板来配置 DHCP 服务(如果启用了管理 DHCP) 2.将一个存储库(yum 或 rsync)建立镜像或解压缩一个媒介,以注册一个新操作系统 3.在 DHCP

运维自动化之Cobbler部署安装RHEL7.0(详细图解版)

一.简介     Cobbler 可以用来快速建立 Linux 网络安装环境,它已将 Linux 网络安装的技术门槛,从大专以上文化水平,成功降低到初中以下,连补鞋匠都能学会.          网络安装服务器套件 Cobbler(补鞋匠)从前,我们一直在做装机民工这份很有前途的职业.自打若干年前 Red Hat 推出了 Kickstart,此后我们顿觉身价倍增.不再需要刻了光盘一台一台地安装 Linux,只要搞定 PXE.DHCP.TFTP,还有那满屏眼花缭乱不知所云的 Kickstart 脚

用系统为centos6的主机,搭建PXE服务器,实现批量安装centos6,7系统

1. iptables -F setenforce 0 临时关掉selinux,清掉防火墙 永久生效更改配置文件:vim /etc/sysconfig/selinux chkconfig iptables off 2. yum -y install httpd dhcp tftp-server 安装http服务用于构建镜像文件的yum仓库 安装dhcp服务,搭建dhcp服务器,为客户端分配ip地址 安装tftp服务,搭建tftp服务器,准备系统启动的引导文件,如pxelinux.0 menu32

Cobbler全自动批量安装部署Linux系统

前言:这篇文章是系统运维www.osyunwei.com的作品,我只是根据实践了一下,出于对原作者的尊重附原文链接如下: 原文链接:http://www.osyunwei.com/archives/7606.html 根据文章的说明是可以完成所属功能的,不过原文章有点小问题,在本文中我已经修改过了,仅供大家参考,有问题大家交流,E-mail:[email protected] 安装之前的一点说明 Cobbler服务器系统:CentOS5.10 64位 IP地址:192.168.21.128 需要

cobbler批量安装系统使用详解-技术流ken

1.前言 cobbler是一个可以实现批量安装系统的Linux应用程序.它有别于pxe+kickstart,cobbler可以实现同个服务器批量安装不同操作系统版本. 2.系统环境准备及其下载cobbler 一.系统环境 系统版本:CentOS release 6.7 (Final) 内网IP:192.168.232.7/24    #用来对内通信,提供cobbler服务 外网IP:10.220.5.166/24      #连接外网 二. 关闭安全服务 [[email protected] ~

cobbler批量安装linux(centos6.5)

1.安装 cobbler (1).安装第三方软件库所需要的包 #cd /tmp #wget  http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm #rpm -ivh epel-release-6-8.noarch.rpm (2).安装 dhcp #yum -y install dhcp (3). 安装其他的相关软件 #yum -y install tftp rsync xinetd httpd (

网络安装操作系统之——-cobbler批量安装操作系统

cobbler批量安装操作系统 环境:workstation10 cobbler server:操作系统 Centos6.6 ip:192.168.1.17 桥接物理机上(可上外网) 关闭iptables ,关闭selinux [[email protected] ~]# chkconfig iptables off [[email protected] ~]# /etc/init.d/iptables stop [[email protected] ~]# getenforce Disable

搭建Pxe服务器无人听应答全自动安装CentOS6.7系统

概念解说 PXE(preboot execute environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持通过网络启动操作系统,在启动过程中,终端要求服务器分配IP地址,再用TFTP(trivial file transfer protocol)或MTFTP(multicast trivial file transfer protocol)协议下载一个启动软件包到本机内存中执行,由这个