Cobbler自动化批量部署CentOS6.5系统
Cobbler作为一个预备工具,使批量部署Red Hat/Centos/Fedora系统更容易,同时也支持Suse和Debian系统的部署。
它提供以下服务集成:
* PXE服务支持
* DHCP服务管理
* DNS服务管理
* Kickstart服务支持
* yum仓库管理
Cobbler客户端Koan支持虚拟机安装和操作系统重新安装功能.
一、cobbler安装准备
系统:CentOS6.5 64位
IP地址:192.168.132.128
1.关闭selinux
[root@localhost ~]#vim /etc/selinux/config
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增加 :wq! #保存退出
[root@localhost ~]#setenforce 0 #使配置立即生效
[root@localhost ~]#sestatus #重启后查看
2.关闭iptables
[root@localhost ~]#chkconfig iptables off
[root@localhost ~]#/etc/init.d/iptables stop
3.下载epel源的rpm安装包并安装cobbler软件
[root@localhost ~]#wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@localhost ~]#rpm -ivh epel-release-6-8.noarch.rpm
[root@localhost ~]#yum -y install cobbler cobbler-web httpd rsync tftp-server xinetd dhcp python-ctypes debmirror pykickstart fence-agents cman [root@localhost ~]# /etc/init.d/cobblerd start
Starting cobbler daemon: [ OK ]
[root@localhost ~]# /etc/init.d/httpd start
Starting httpd: [ OK ]
[root@localhost ~]#
4.检查配置执行:
[root@localhost ~]# cobbler check
Traceback (most recent call last):
File "/usr/bin/cobbler", line 36, in <module>
sys.exit(app.main())
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 657, in main
rc = cli.run(sys.argv)
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 270, in run
self.token = self.remote.login("", self.shared_secret)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response
return u.close()
File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: "<class 'cobbler.cexceptions.CX'>:'login failed'">
报错了
经过网上查找这样解决如下:
[root@localhost ~]# /etc/init.d/cobblerd restart
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: [ OK ]
[root@localhost ~]#
[root@localhost ~]# cobbler get-loaders
task started: 2016-04-07_020452_get_loaders
task started (id=Download Bootloader Content, time=Thu Apr 7 02:04:52 2016)
downloading http://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
downloading http://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading http://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading http://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading http://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading http://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading http://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading http://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading http://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading http://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***
再次检查配置:
[root@localhost ~]# 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 : change 'disable' to 'no' in /etc/xinetd.d/tftp
4 : change 'disable' to 'no' in /etc/xinetd.d/rsync
5 : file /etc/xinetd.d/rsync does not exist
6 : comment out 'dists' on /etc/debmirror.conf for proper debian support
7 : comment out 'arches' on /etc/debmirror.conf for proper debian support
8 : ksvalidator was not found, install pykickstart
9 : 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 Restart cobblerd and then run 'cobbler sync' to apply changes.
根据cobbler check 检测所的信息,进行相应配置:
1.配置tftp-server与rsync 设置rsync和tftp服务开机启动.
编辑/etc/cobbler/settings文件,找到 server选项,修改为适当的ip地址,本实例配置ip为:192.168.132.128 sed -i 's@manage_dhcp: 0@manage_dhcp: 1@g' /etc/cobbler/settings
sed -i 's@next_server: 127.0.0.1@next_server: '192.168.132.128'@g' /etc/cobbler/settings
sed -i 's@server: 127.0.0.1@server: '192.168.132.128'@g' /etc/cobbler/settings
2.配置tftp-server与rsync.
sed -i 's/disable.*$/disable = no/g' /etc/xinetd.d/tftp
sed -i 's/disable.*$/disable = no/g' /etc/xinetd.d/rsync
3.提示说debmirror没安装。如果不是安装 debian之类的系统,此提示可以忽略。
4.安装pykickstart.
[root@localhost ~]# yum install pykickstart -y
5.生成密码串(设置默认 root 用户的密码):
[root@localhost ~]# openssl passwd -1 -salt 'random-phrase-here' 'saneri'
$1$random-p$3a6Zq0MlL6NuutFGzwxGJ.
然后将结果替换 /etc/cobbler/settings 文件中的
default_password_crypted:
根据提示基本配置完成了,OK再来执行检查.
[root@localhost cobbler]# /etc/init.d/cobblerd restart
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: [ OK ] [root@localhost cobbler]# cobbler check
The following are potential configuration items that you may want to fix: 1 : service dhcpd is not running
2 : file /etc/xinetd.d/rsync does not exist
3 : comment out 'dists' on /etc/debmirror.conf for proper debian support
4 : comment out 'arches' on /etc/debmirror.conf for proper debian support Restart cobblerd and then run 'cobbler sync' to apply changes.
配置dhcp服务
修改/etc/cobbler/dhcp.template,此文件是cobbler管理dhcp的模板和/etc/dhcp/dhcpd.conf文件,两个配置内容一样
cat > /etc/cobbler/dhcp.template <<EOF 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.132.0 netmask 255.255.255.0 { #设置网段
option routers 192.168.132.1; #设置网关
option subnet-mask 255.255.255.0; #子网掩码
range dynamic-bootp 192.168.132.30 192.168.132.35; #动态IP范围
option domain-name-servers 8.8.8.8,8.8.4.4; #DNS地址
default-lease-time 43200; #缺省租约时间
max-lease-time 86400; #最大租约时间
log-facility local7; #
filename="pxelinux.0";
next-server $next-server; #指定引导服务器
} EOF
重新启动相关服务
[root@localhost cobbler]# /etc/init.d/dhcpd restart
Starting dhcpd: [ OK ] [root@localhost dhcp]# /etc/init.d/cobblerd restart
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: [ OK ] [root@localhost dhcp]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
同步配置模板
[root@localhost dhcp]# cobbler sync #同步配置模板
task started: 2016-04-07_052540_sync
task started (id=Sync, time=Thu Apr 7 05:25:40 2016)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/CentOS6.5-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/images/CentOS6.5-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
copying distros to tftpboot
copying files for distro: CentOS6.5-x86_64
trying hardlink /var/www/cobbler/ks_mirror/CentOS6.5-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/CentOS6.5-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS6.5-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/CentOS6.5-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: CentOS6.5-x86_64
trying hardlink /var/www/cobbler/ks_mirror/CentOS6.5-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/CentOS6.5-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS6.5-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/CentOS6.5-x86_64/initrd.img
Writing template files for CentOS6.5-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
processing boot_files for distro: CentOS6.5-x86_64
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: dhcpd -t -q
received on stdout:
received on stderr:
running: service dhcpd restart
received on stdout: Starting dhcpd: [ OK ] received on stderr:
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 ***
挂载系统镜像并导入镜像:
[root@localhost ~]#mkdir /mnt/ios/
[root@localhost ~]#mount -t iso9660 -o loop /dev/cdrom /mnt/ios/
[root@localhost ~]#cobbler import --path=/mnt/ios --name=CentOS6.5 --arch=x86_64 #命令格式:cobbler import --path=镜像路径 -- name=安装引导名 --arch=32位或64位
查看导入源库列表:
[root@localhost dhcp]# cobbler distro list
CentOS6.5-x86_64
################################################ 至此cobbler已经可以使用了################################################
Cobbler常用命令详解:
cobbler check #检查cobbler配置(主要用于检查cobbler配置是否有错.)
cobbler sync #同步配置到dhcp/pxe和数据目录(注,同步cobbler配置到数据目录中,更改某些配置后得执行一下,同步一下配置)
cobbler list #列出所有的cobbler元素
cobbler import #导入安装的系统镜像
cobbler report #列出各元素的详细信息
cobbler distro #查看导入的发行版系统信息
cobbler profile #查看配置信息
cobbler system #查看添加的系统信息
cobbler reposync #同步yum仓库到本地
cobbler profile remove --name=CentOS6.5x86_64-x86_64 #移除profile
cobbler distro remove --name=CentOS6.5x86_64-x86_64 #移除distro cobbler profile report --name CentOS6.5-x86_64 #查看profile设置
cobbler profile report --name CentOS6.5-x86_64 #查看安装镜像文件信息 cobbler profile add --name=centos-6.5-x86_64 --distro=centos-6.5-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos-6.5-x86_64.ks #添加
.
.
参阅文档:http://www.osyunwei.com/archives/7606.html
http://blog.oldboyedu.com/autoinstall-cobbler/
Cobbler自动化批量部署CentOS6.5系统的更多相关文章
- 基于Centos7.2搭建Cobbler自动化批量部署操作系统服务
1 Cobbler服务器端系统环境配置 1.1 系统基本环境准备 [root@cobbler-server ~]# cat /etc/redhat-release CentOS L ...
- Cobbler自动化批量安装Linux操作系统 - 运维总结
一.Cobbler简述 Cobbler是一个自动化和简化系统安装的工具,通过使用网络引导来控制和启动安装.Cobbler的特性包括存储库镜像.Kickstart模板和连接电源管理系统.Cobbler通 ...
- Jenkins +svn +maven +tomcat+ ansible 自动化批量部署
Jenkins +svn +maven +tomcat+ ansible 自动化批量部署 一.部署svn yum install subversion 先创建目录 mkdir /home/svn 创建 ...
- Cobbler自动化安装部署系统
自动化安装部署 https://www.cnblogs.com/nulige/p/6796593.html PXE+Kickstart工作原理 pxe+kickstart工作流程 网卡上的pxe芯片有 ...
- Cobbler自动化批量安装linux服务器的操作记录
Cobbler为何物?Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命 ...
- PXE批量部署安装Linux系统
PXE介绍 1)Preboot Excution Environment 预启动执行环境 2)Intel公司研发 3)基于Client/Server的网络模式,支持远程主机通过网络从远端服务器下载映 ...
- 用系统为centos6的主机,搭建PXE服务器,实现批量安装centos6,7系统
1. iptables -F setenforce 0 临时关掉selinux,清掉防火墙 永久生效更改配置文件:vim /etc/sysconfig/selinux chkconfig iptabl ...
- Linux记录-shell自动化批量部署sql脚本并记录日志信息(转载)
#!/bin/bash #script_version=v110 db_host=127.0.0.1 db_port=3306 db_username=db_test_inst db_passwd=` ...
- Cobbler批量部署CentOS
简介 Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命令即可完成PXE ...
随机推荐
- hdu4990 矩阵
C - Reading comprehension Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & ...
- C#-WinForm-打开其他窗体的三种方式-Show()、设置Owner()、ShowDialog()
打开其他窗体的三种方式 Show - 例如登入界面进入主页面,直接将主页面展示出来,两个窗体互不影响 public partial class Form1 : Form { public Form1( ...
- 【USACO 2.1】The Castle
/* TASK: castle LANG: C++ SOLVE: 深搜,注意每个方向对应值.枚举去掉的墙,然后再dfs,注意墙要复原,并且dfs里要判断是否超出边界. */ #include<c ...
- 内部类访问外部类的变量必须是final吗,java静态方法中不能引用非静态变量,静态方法中不能创建内部类的实例
内部类访问外部类的变量必须是final吗? 如下: package com.java.concurrent; class A { int i = 3; public void shout() { cl ...
- BZOJ1024 [SCOI2009]生日快乐
本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000作者博客:http://www.cnblogs.com/ljh2000-jump/转 ...
- Java包的命名规范
indi : 个体项目,指个人发起,但非自己独自完成的项目,可公开或私有项目,版权主要属于发起者. 包名为indi.发起者名.项目名.模块名*.*.* pers : 个人项目,指个人发起,独自完成,可 ...
- Jenkins 2.x新建节点配置(Windows)
2.0版本以上默认加入了权限插件,所以在进入主界面时是需要登录的. 一.主界面->[系统管理]->[管理节点]->[新建节点],进行节点的添加: 二.输入节点名称,已经选择[Perm ...
- 洛谷P2853 [USACO06DEC]牛的野餐Cow Picnic
题目描述 The cows are having a picnic! Each of Farmer John's K (1 ≤ K ≤ 100) cows is grazing in one of N ...
- 分析ffmpeg解析ts流信息的源码
花费一些时间,然后全部扔了.为了不忘记和抛砖引玉,特发此贴. ffmpeg解析ts流 1.目的 打算软件方式解析出pat,pmt等码流信息 2.源代码所在位置 下载ffmpeg ...
- 拉曼软件在win8上运行出错问题
前提:xp上安装运行都没错 xp的.NET 环境是4.0 ,win8 是64位系统.自带.NET Framework 3 (3.0 3.5) 和.NET Framework 4.51:源程序拷贝到w ...