品运维自动化之cobbler的安装序

品茶提示:

1、安装如遇错误,请查看错误报告收集。

2、如遇文章出现错误之处请指出并回复以便帮助更多的朋友,或者发邮件至zwhset@163.com,我将定期回复。

2013/10/24更新内容:

1、添加ks.cfg文件

2012/11/2更新内容:

1、添加安装条件。
2、添加图片。
3、添加cobbler工作流程。
4、增加CentOS6的下载源

2012/11/3更新内容:

1、更新视平教程,建议全屏观看,挺清楚的。{注:声音哑了,不是太好。中间有一个卡顿是由于cobbler improt载入时间太长,将近半个小时。所以后期剪了一下。}

使用前提:

1、你有一个DVD或ISO文件,您的操作系统的分布。
2、服务器有足够的本地磁盘的可用空间在/var/www/cobbler 解压缩DVD/ISO。
3、服务器和客户端都有一个共同的IP网络。
4、这个网络上的DHCP服务器的服务器是唯一的实例。
5、在此网络上的客户端是支持PXE网络启动。

Cobbler工作流程:

一、加载Fedor的Epel源

CentOS 5 x86_64
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
CentOS6 x86_64:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
CentOS6 i386:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm

二、开始安装
1、Yum安装所需文件
yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes -y
2、效验cobbler安装条件
cobbler check
3、更改配置以适用于cobbler运行
vi /etc/cobbler/settings
'next_server: 127.0.0.1' 替换成 'next_server:本机IP地址' {注:此为DHCP服务地址}

'server: 127.0.0.1' 替换成 'server: 192.168.0.28' {此为cobbler服务地址}
'manage_dhcp: 0' 替换成 'manage_dhcp: 1' {注:此为使cobbler管理dhcp也就是后面用于同步更新配置信息[cobbler sync]}
'manage_rsync: 0' 替换成 'manage_rsync: 1' {注:此为使cobbler管理rsync功能}
2、针对SELinux权限设置,在此我们关闭SELinux,也可根据提示进行更改。
3、进行更新fedora的loader信息
cobbler get-loaders
4、设置 'disable' 为 'no'
vi /etc/xinetd.d/tftp
5、设置 'disable' 为 'no'
vi /etc/xinetd.d/rsync
6、#your-password-here处设置你需要的密码。此为防止误装。
openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'
7、修改默认dhcp。{注:一例实例,详细可查看以前博客kickstart相关。}
vi /etc/cobbler/dhcp.template
ddns-update-style interim;

allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
#需要修改192.168.0.0为自己网段
subnet 192.168.0.0 netmask 255.255.255.0 {
#修改自己的路由
option routers 192.168.0.1;
#域名服务器地址
option domain-name-servers 202.106.0.20;
#子网掩码
option subnet-mask 255.255.255.0;
#分配IP地址段
range dynamic-bootp 192.168.0.100 192.168.0.254;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
三、导入镜像进行配置
1、上传ISO镜像至服务器
2、创建文件夹
mkdir -p /system/centos5.4-i686
3、挂载ISO镜像到/system/centos5.4-i686目录
mount -o loop ~/install/CentOS-5.5-x86-bin-DVD.iso /system/centos5.4-i686/
4、从DVD中导入客户端的OS。这将自动设置了“x86_64”,并将其命名为centos5.4-i686。{注:这需要一点时间,不要急。可查看/var/www/cobbler/ks_mirror/centos5.4-i686-x86_64/目录文件生成情况。}
cobbler import --path=/system/centos5.4-i686/ --name=centos5.4-i686 --arch=x86_64
5、比较一下大小
[root@cobbler ~]# du -sh /var/www/cobbler/ks_mirror/centos5.4-i686-x86_64/

3.9G/var/www/cobbler/ks_mirror/centos5.4-i686-x86_64/
[root@cobbler ~]# du -sh /system/centos5.4-i686/
4.1G/system/centos5.4-i686/
6、更改kickstart文件,可为http等,具体cobbler --help查看 {可选择执行}
cobbler profile edit --name=centos5.4-i686-x86_64 --kickstart=???
7、cobbler report进行信息查看{注:下面取一段。方便更加详细了解cobbler结构。}
Name : centos5.4-i686-x86_64

TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : centos5.4-i686-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/sample.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 : qemu
8、查看导入列表
cobbler distro list
9、获取上述所有配置的cobbler(包括启动DHCP等)
cobbler sync

10、正确安装后客户端启动出现图为如下:

四、信息区:
1、coobler 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 : you need to set some SELinux content rules to ensure cobbler serves content correctly in your SELinux environment, run the following: /usr/sbin/semanage fcontext -a -t public_content_t "/tftpboot/.*" && /usr/sbin/semanage fcontext -a -t public_content_t "/var/www/cobbler/images/.*"
4 : you need to set some SELinux rules if you want to use cobbler-web (an optional package), run the following: /usr/sbin/semanage fcontext -a -t httpd_sys_content_rw_t "/var/lib/cobbler/webui_sessions/.*"
5 : 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.
6 : change 'disable' to 'no' in /etc/xinetd.d/tftp
7 : change 'disable' to 'no' in /etc/xinetd.d/rsync
8 : debmirror package is not installed, it will be required to manage debian deployments and repositories
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.

2、什么是Rsync

rsync is an open source utility that provides fast incremental file transfer. rsync is freely available under the GNU General Public License and is currently being maintained by Wayne Davison.

Rsync是一个开源的 应用程序,提供快速增量文件传输。Rsync是免费提供根据GNU通用公共许可证,目前正在维护 韦恩·戴维森。

3、收集常用命令:

#重命名安装选项名字:
cobbler profile rename --name='old name' –newname='new name'
#册除选项:
cobbler profile rename --name='old name'

4、KickStart options详解:
引用:

kickstart是什么

许多系统管理员宁愿使用自动化的安装方法来安装红帽企业 Linux.为了满足这种需要,红帽创建了kickstart安装方法.使用kickstart,系统管理员可以创建一个文件,这个文件包含了在典型的安装过程中所遇 到的问题的答案.

Kickstart文件可以存放于单一的服务器上,在安装过程中被独立的机器所读取.这个安装方法可以支持使用单一kickstart文件在多台机器上安装红帽企业Linux,这对于网络和系统管理员来说是个理想的选择.

Kickstart给用户提供了一种自动化安装红帽企业Linux的方法.

如何执行kickstart安装

kickstart 安装可以使用本地光盘,本地硬盘驱动器,或通过 NFS,FTP,HTTP 来执行.

要使用 kickstart,必须:

1.创建一个kickstart文件.

2.创建有kickstart文件的引导介质或者使这个文件在网络上可用.

3.筹备安装树.

4.开始kickstart安装.
更多:可查看下载附件。或者网页地址,

http://blog.chinaunix.net/uid-17240700-id-2813881.html

五、错误报告:
1、cobblerd校验错误:
cobblerd does not appear to be running/accessible
解决方法:
service cobblerd start

service httpd start
2、重启httpd错误:
Starting httpd: Syntax error on line 10 of /etc/httpd/conf.d/cobbler.conf:

Invalid command 'WSGIScriptAliasMatch', perhaps misspelled or defined by a module not included in the server configuration
解决方法:
vi /etc/httpd/conf.d/wsgi.conf
#LoadModule wsgi_module modules/mod_wsgi.so 去掉#号,使之成为:LoadModule wsgi_module modules/mod_wsgi.so。
3、httpd、SELinux未运行:
httpd does not appear to be running and proxying cobbler, or SELinux is in the way. Original traceback:

Traceback (most recent call last):
解决方法:
service httpd start

vi /etc/sysconfig/selinux
SELINUX=enforcing更改为SELINUX=disabled,重启使之生效。

4、较验cobbler check出错

Traceback (most recent call last):

File "/usr/bin/cobbler", line 35, in ?
sys.exit(app.main())
File "/usr/lib/python2.4/site-packages/cobbler/cli.py", line 558, in main
rc = cli.run(sys.argv)
File "/usr/lib/python2.4/site-packages/cobbler/cli.py", line 202, in run
self.token = self.remote.login("", self.shared_secret)
File "/usr/lib64/python2.4/xmlrpclib.py", line 1096, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.4/xmlrpclib.py", line 1383, in __request
verbose=self.__verbose
File "/usr/lib64/python2.4/xmlrpclib.py", line 1147, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib64/python2.4/xmlrpclib.py", line 1286, in _parse_response
return u.close()
File "/usr/lib64/python2.4/xmlrpclib.py", line 744, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: "cobbler.cexceptions.CX:'login failed'">
解决方法:此为BUG,按下方操作执行即可。
service cobblerd restart

cobbler get-loaders
六、参考地址:
https://github.com/cobbler/cobbler/wiki/Start%20Here

http://dl528888.blog.51cto.com/2382721/1004298
#cobbler设置相关:
https://github.com/cobbler/cobbler/wiki/Using%20Cobbler%20Import
#KickStart配置:
https://github.com/cobbler/cobbler/wiki/Kickstart%20snippets
煮酒品茶:遇错误多看/var/log/message再根据百度谷歌解决。

未完待续......

kickstart file:

注:这是从51CTO一网友搞过来的,忘了地址。

#set $swap= $getVar('$swap', '12000')

autostep --autoscreenshot

install

url --url=$tree

# If any cobbler repo definitions were referenced in the kickstart profile, include them here.

$yum_repo_stanza

text

skipx

lang en_US.UTF-8

keyboard us

network --onboot yes --bootproto dhcp --noipv6 --nodns

rootpw --iscrypted $1$xzY0mzCP$bBhzWwNV.ECfF.MV9PRkC1

firewall --disabled

firstboot --disabled

authconfig --enableshadow --passalgo=sha512

selinux --disabled

#timezone --isUtc Asia/Shanghai

timezone --utc Asia/Shanghai

# The following is the partition information you requested

# Note that any partitions you deleted are not expressed

# here so unless you clear all partitions first, this is

# not guaranteed to work

logging --level=info

#bootloader --append="nohz=off" --location=mbr

bootloader --location=mbr

#bootloader --location=mbr --driveorder=sda --append="biosdevname=0 nohz=off thash_entries=1048576 rhash_entries=1048576 selinux=0"

zerombr yes

# clearpart --all --initlabel --drives=sda

clearpart --all --initlabel

# ignoredisk --only-use=sda

#part / --fstype=ext4 --asprimary --size=50000 --maxsize=50000 --label=/

#part swap --asprimary --size=$swap --maxsize=$swap --label=swap

#part /data --fstype=xfs --grow --asprimary --size=12000 --label=/data

part /boot --fstype="ext4" --size=200

part swap --fstype="swap" --size=1024

part / --fstype="ext4" --grow --size=1

%pre

$SNIPPET('pre_install_network_config')

# Add Pre-Installation Script here

date

%end

%packages --excludedocs --ignoremissing

@base

@core

@development

@server-policy

telnet

-iptables

%end

$SNIPPET('services_disable_enable')

%post

$SNIPPET('post_install_network_config')

$SNIPPET('env_init')

$SNIPPET('kis_cobbler_api')

$SNIPPET('cactirelease')

$SNIPPET('kisyum_install')

/usr/sbin/eject -rv /dev/sr* # eject P cdrom

echo 'v1.3' > ~root/VERSION

%end

# finish

reboot

#reboot --eject

煮酒品茶记于2012/11/1日

品运维自动化之cobbler的安装序相关推荐

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

    运维自动化工具--Cobbler实践 第1章 About Cobbler 1.1 Cobbler Introduction Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的 ...

  2. 运维自动化之Cobbler安装配置

    Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才15k行代码),使用简单的命令即可完成PXE网络安装环境的配置 ...

  3. 运维自动化之 Cobbler 系统安装使用详解

    一.简介 Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命令即可完成P ...

  4. Linux 运维自动化之Cobbler实战案例

    大纲 一.前言 二.Cobbler 工作原理详解 三.Cobbler 常用命令汇总 四.Cobbler 各种目录说明 五.自定义Kickstart文件详解 六.Cobbler 实战案例安装CentOS ...

  5. 运维自动化工具-ansible的安装与ad-hoc模式场景应用

    使用 yum 安装 yum install epel-release -y yum install ansible –y 无论是yum安装还是pip安装,都会遇到各种意外的错误,主要是安装的时候依赖比 ...

  6. 运维自动化之ansible playbook安装apache

    上次介绍了如何使用ansible安装lnmp(地址是http://dl528888.blog.51cto.com/2382721/1440775),现在介绍如何使用ansible安装apache. 下 ...

  7. 自动化运维系列之Cobbler (资源)

    2019独角兽企业重金招聘Python工程师标准>>> 下图为开源自动化运维体系链: 1.cobbler实现自动装机 2.saltstack实现工程自动化配置 3.kubernete ...

  8. 第19章,运维自动化之系统安装

    更多内容请点击: Linux学习从入门到打死也不放弃,完全笔记整理(持续更新,求收藏,求点赞~~~~) https://blog.51cto.com/13683480/2095439 第19章,运维自 ...

  9. 运维自动化之ANSIBLE

    成功不易,加倍努力! 运维自动化之ANSIBLE 本章内容 1 自动化运维应用场景 1.1 云计算运维工程师核心职能 1.2 运维职业发展路线 1.3 企业实际应用场景分析 1.3.1 Dev开发环境 ...

最新文章

  1. 2月国内搜索市场:360继续上升 百度下降0.62%
  2. DotNet 项目开发文档的自动生成和相关工具的使用
  3. spring事务(三)
  4. @所有人 Flink Forward Asia 2020 向您发出议题征集邀请!
  5. jQuery ajax - getScript() 方法
  6. 使用SAP云平台Portal service的前置条件
  7. 覆盖索引与联合索引_浅析MySQL的索引覆盖和索引下推
  8. mongodb mysql资源占用_如何限制mongodb启动时占用过多内存
  9. walle 2.0 上线部署
  10. linux qt 系统时间,QT在linux环境下读取和设置系统时间
  11. 当归饮(茶):治疗血虚
  12. 深度集成 Flink: Apache Iceberg 0.11.0 最新功能解读
  13. mac book 专用最新款win10镜像
  14. 机器视觉技术的应用领域
  15. IDEA价格对程序员来说九牛一毛,为啥这么多人用破解版?
  16. 程序人生 - BD 电影 HD 电影有什么区别啊?哪个好啊?
  17. CSAPP导读第3章 程序的机器级表示
  18. go-kit入门指南
  19. java erc 2.0_如何使用Web3j库管理Java中的ERC20令牌
  20. MatlabSimulink开发STM32F4

热门文章

  1. Git 存在多个漏洞,开发人员应及时更新
  2. 这款Linux 恶意软件正在劫持全球的超级计算机
  3. 30美元攻陷Intel SGX enclave,Intel 不打算修复
  4. [洛谷P1119]灾后重建
  5. EJB3.0高速入门项目开发步骤
  6. WampServer下开启curl
  7. Android4.0源码编译方法以及错误解决方案
  8. iPhone iPhoneSimulator.platform/Developer/usr/bin/clang++ failed with exit code 1 出现这种错误的原因是...
  9. 蓝桥杯 ADV-145 算法提高 铺地毯
  10. 蓝桥杯 ALGO-157 算法训练 阶乘末尾