cobbler自动化安装详解

Cobbler介绍

cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.改工具使用python开发,小巧轻便,使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP,DNS,以及yum包镜像。

Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用。

1、安装Cobbler

需要EPEL的YUM源,否则就需要下载源码安装

[[email protected] ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.0eoNVV: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]

2、yum安装Cobbler组件

yum install cobbler colbbler-web pykickstart debmirror

安装后cobbler的配置文件

[[email protected] cobbler]# ls
auth.conf         completions       named.template  tftpd.template
cheetah_macros    dhcp.template     power           users.conf
cobbler_bash      dnsmasq.template  pxe             users.digest
cobbler.conf      iso               reporting       version
cobblerd_rotate   ldap              rsync.exclude   zone.template
cobblerd.service  modules.conf      rsync.template  zone_templates
cobbler_web.conf  mongodb.conf      settings

3、启动cobbler服务

service cobblerd start
监听端口:
ss -tanulp
LISTEN     0      5                 127.0.0.1:25151                    *:*

4、检查cobbler的配置

首先要启动httpd服务
service httpd start
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.
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.
3 : 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.
4 : change ‘disable‘ to ‘no‘ in /etc/xinetd.d/rsync
5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
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

Restart cobblerd and then run ‘cobbler sync‘ to apply changes.

错误解释

1:/etc/cobbler/settings/中的server必须要与外部指令交互的地址。

2:PXE的服务必须要启动,/etc/cobbler/settings必须要指定web主机通信的地址。

3:pxe和cobbler等所需要的驱动文件。需要安装syslinux等插件

4:需要启动rsync服务

5:debmirror安装包还没有安装。如果不是安装debin系统可以忽略

6:需要定义密码

7:电源管理,需要安装cman,可以忽略

解决错误

1-2修改 vim /etc/cobbler/settings
next_service 192.168.254.2
service  192.168.254.2
3 cobbler get-loaders
4 vim /etc/xinetd.d/rsync   将disable改为no 重启xinetd服务
6 生成随机密码
[[email protected] tftpboot]# openssl passwd -1 -salt `openssl rand -hex 4`
Password: 
$1$df831563$APGIddt4A3ggUkCWnVDYu1
7 yum -y install cman fenc-agents 可以不用安装

最后重启服务,同步数据

[[email protected] cobbler]# service cobblerd restart 
Stopping cobbler daemon: [  OK  ]
Starting cobbler daemon: [  OK  ]
cobbler check
cobbler sync

5、启动dhcp服务

service dhcpd start

DHCP的配置在此文中不描述

6、启动tftp服务

二、导入安装光盘镜像文件

先用光盘去加载安装镜像

mount -r /dev/cdrom /var/ftp/pub/centos-6.4-x86_64
cobbler import --name="centos-6.4-x86_64" --path=/var/ftp/pub/centos-6.4-x86_64/
加载后可以查看distro
[[email protected] ~]# cobbler distro list
   centos-6.4-x86_64

制作一份kickstart.cfg文件。此文不再描述

创建一份profile,profile中需用到profile name distro(加载过的镜像文件) kickstart的文件路径
 cobbler profile add --name=centos-6.4-x86_64-basic --distro=centos-6.4-x86_64 --kickstart=/root/centos6.cfg
[[email protected] ~]# cobbler list
distros:
   centos-6.4-x86_64

profiles:
   centos-6.4-x86_64           自动生成的profile可以删除
   centos-6.4-x86_64-basic
[[email protected] ~]# cobbler sync
task started: 2014-12-11_164024_sync
task started (id=Sync, time=Thu Dec 11 16:40:24 2014)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/centos-6.4-x86_64
removing: /tftpboot/pxelinux.cfg/default
removing: /tftpboot/grub/efidefault
removing: /tftpboot/grub/images
removing: /tftpboot/images/centos-6.4-x86_64
removing: /tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /tftpboot/pxelinux.0
copying: /var/lib/cobbler/loaders/pxelinux.0 -> /tftpboot/pxelinux.0
trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /tftpboot/menu.c32
copying: /var/lib/cobbler/loaders/menu.c32 -> /tftpboot/menu.c32
trying hardlink /var/lib/cobbler/loaders/yaboot -> /tftpboot/yaboot
copying: /var/lib/cobbler/loaders/yaboot -> /tftpboot/yaboot
copying distros to tftpboot
copying files for distro: centos-6.4-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos-6.4-x86_64/images/pxeboot/vmlinuz -> /tftpboot/images/centos-6.4-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos-6.4-x86_64/images/pxeboot/initrd.img -> /tftpboot/images/centos-6.4-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: centos-6.4-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos-6.4-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos-6.4-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos-6.4-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos-6.4-x86_64/initrd.img
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 ***

查看加载后的配置选项

[[email protected] tftpboot]# cat /tftpboot/pxelinux.cfg/default 

LABEL centos-6.4-x86_64-basic
        kernel /images/centos-6.4-x86_64/vmlinuz
        MENU LABEL centos-6.4-x86_64-basic
        append initrd=/images/centos-6.4-x86_64/initrd.img ksdevice=bootif lang=  kssendmac text  ks=http://192.168.254.2/cblr/svc/op/ks/profile/centos-6.4-x86_64-basic
        ipappend 2
时间: 2024-08-07 18:00:25

cobbler自动化安装详解的相关文章

自动化运维平台之系统自动化安装Cobbler系统使用详解

一.简介 Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP.DNS.以及yum仓库.构造系统ISO镜像. Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用. Cobbler客户端Koan支持虚拟机安装和操作系统重新安装,使重装系统更便捷. 二.cobbler提供的功能 使用

Centos6上安装cobbler及cobbler常见参数详解

前言 Cobbler是一个自动化和简化系统安装的工具,通过使用网络引导来控制和启动安装.Cobbler的特性包括存储库镜像.Kickstart模板和连接电源管理系统.使用Cobbler之前需要先了解下PXE和Kickstart的基本原理,文章包含了Cobbler工作原理和Cobbler部署实践两部分内容,交叉关联性的内容还是蛮多的,遇到报错也不要怕,都会一步一步解决的. 使用Cobbler轻松设置和管理网络安装环境 Cobbler工作原理 Cobbler由Python语言开发,是对PXE和Kic

httpd 安装详解(待更新)

httpd 安装详解 安装httpd: rpm包:CentOS发行版中直接提供 编译安装:定制新功能,或其它原因 安装方式: yum install httpd CentOS 6:httpd-2.2 程序环境: 配置文件: /etc/httpd/conf/httpd.conf/httpd /etc/httpd/conf.d/*.conf 服务脚本: /etc/rc.d/init.d/httpd 脚本配置文件:/etc/sysconfig/httpd 主程序文件: /usr/sbin/httpd

Gentoo Linux安装详解--根据官方WiKi整理

1. 前期准备 远程登录: 开启ssh服务: /etc/init.d/sshd start 设置密码: passwd 以便使用putty.ssh client远程登录上传stage等(有时在线下载很慢,而局域网上传很快) 准备磁盘: 分区: fdisk /dev/sda /dev/sda1 : /boot 100M(32-100M) 设启动笔记-a/dev/sda2 : / 20G/dev/sda3 : /home 20G/dev/sda5 : /swap 1G (内存< 512 MB,分区分配

Linux下ORACLE客户端安装详解

1.首先去oracle官网下载以下安装包(http://www.oracle.com/technetwork/topics/linuxsoft-082809.html) instantclient-basic-linux.x64-11.2.0.3.0.zip instantclient-odbc-linux-11.2.0.3.0.zip instantclient-sdk-linux.x64-11.2.0.3.0.zip instantclient-sqlplus-linux.x64-11.2.

Windows下caffe安装详解(仅CPU)

本文大多转载自 http://blog.csdn.net/guoyk1990/article/details/52909864,加入部分自己实战心得. 1.环境:windows 7\VS2013 2.caffe-windows准备 (1)下载官方caffe-windows并解压,将 .\windows\CommonSettings.props.example备份,并改名为CommonSettings.props.如图4所示: 图 4:修改后的CommonSettings.props文件 附带说明

MySQL安装详解

MySQL安装详解 [下载地址:http://dev.mysql.com/downloads/] 参考文献:http://dev.mysql.com/doc/refman/5.1/zh/installing.html 步骤1:选择安装类型 有3种安装类型:Typical(典型安装).Complete(完全安装)和Custom(定制安装). Typical(典型安装)安装只安装MySQL服务器.mysql命令行客户端和命令行实用程序.命令行客户端和实用程序包括mysqldump.myisamchk

Gentoo Linux安装详解

1. 前期准备 远程登录: 开启ssh服务: /etc/init.d/sshd start 设置密码: passwd 以便使用putty.ssh client远程登录上传stage等(有时在线下载很慢,而局域网上传很快) 准备磁盘: 分区: fdisk /dev/sda /dev/sda1 : /boot 100M(32-100M) 设启动笔记-a/dev/sda2 : / 20G/dev/sda3 : /home 20G/dev/sda5 : /swap 1G (内存< 512 MB,分区分配

Linux ssh登录和软件安装详解

阿哲Style Linux第一天 ssh登录和软件安装详解 Linux学习第一天 操作环境: Ubuntu 16.04 Win10系统,使用putty_V0.63 本身学习Linux就是想在服务器上使用的.实际情况,可能我很难直接到坐在服务器前,使用界面操作系统.事实上,界面对于服务器来说就是一个多于的内容.于是Linux的桌面就像一个程序一样,可以卸载.卸载后怎么用呢?使用shell命令.在哪里使用呢?当然是在遥远的另一方. 于是,我学习的第一个内容就是远程访问Linux系统,进行一系列操作.