设为首页 收藏本站
查看: 541|回复: 0

[经验分享] linux自动化运维之cobbler

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-10-20 09:35:36 | 显示全部楼层 |阅读模式
一:cobbler是什么?
  Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows。该工具使用python开发,小巧轻便(才15k行代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP,DNS,以及yum包镜像。Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用,和PXE不同的是,使用cobbler不会因为在局域网中启动了dhcp而导致有些机器因为默认从pxe启动在重启服务器后加载tftp内容导致启动终止。
二:cobbler常用架构

wKiom1RDKxWzLkuzAADTcatEYQI310.jpg
三:cobbler的安装
  1)安装cobbler需要epel源.利用yum进行安装
1
yum install cobbler



   查看下生成的文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[iyunv@node3 ~]# tree /var/www/cobbler/
/var/www/cobbler/
├── aux
│   ├── anamon
│   └── anamon.init
├── images
├── ks_mirror   
│   └── config
├── links
├── localmirror
├── pub
├── rendered
├── repo_mirror
└── svc
    ├── services.py
    ├── services.pyc
    └── services.pyo
10 directories, 5 files



2)启动前的准备
启动httpd服务.检测cobbler  check
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[iyunv@node3 ~]# service httpd start
[iyunv@node3 ~]# service cobblerd start
Starting cobbler daemon:                                   [  OK  ]

[iyunv@node3 ~]# 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 : ksvalidator was not found, install pykickstart
7 : 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
8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them



启动cobbler后检测了一下发现了许多错误,根据这些错误提示进行排错.

解决第一个问题,编辑vim /etc/cobbler/settings
1
server: 172.16.16.5



解决DHCP服务器问题

1
next_server: 172.16.16.5



确保syslinux已经安装
1
2
3
4
5
6
[iyunv@node3 ~]# yum install syslinux
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Package syslinux-4.02-8.el6.x86_64 already installed and latest version #提示已经安装
Nothing to do



确保rsync开机启动

1
[iyunv@node3 ~]# chkconfig rsync on



安装pykickstart
1
[iyunv@node3 ~]# yum install pykickstart



生成cobbler随机密码并进行替换
1
2
3
4
5
6
[iyunv@node3 ~]# openssl passwd -apr1 -salt 'openssl rand -hex 4'
Password: #输入密码
$apr1$openssl $aA7bNBhsYJPhUH8z6mKS3/

vim /etc/cobbler/setting
default_password_crypted: "$1$mF86/UHC$WvcIcX2t6crBz2onWxyac."



cd /usr/share/syslinux 下复制当前目录的所有文件到 /var/lib/cobbler/loaders/
修改/etc/cobbler/setting配置文件选择是否有cobbler自己提供DHCP和LFTP服务
为1是自己提供为0是单独的服务器提供
修复完成后重启cobblerd和sync

3)提供cobbler依赖的服务
  安装配置DHCP服务
1
yum install dhcp



  提供DHCP的配置文件
1
2
3
cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample   /etc/dhcp
mv dhcpd.conf.sample  dhcpd.conf
vim dhcpd.conf



wKioL1RDMqTDTQn6AACM5jyygGY814.jpg
wKiom1RDMyiyWdzBAAGFCZ3F8DI583.jpg
提供tftp服务器(在安装cobbler时默认已经安装了)
1
2
chkconfig tftp on
service xinetd start



4)提供 distro文件
通过挂载光盘映像文件来提供
wKioL1RDM9bioumCAAHLwQq7NZA113.jpg
mount /dev/cdrom /mnt -r   挂载cdrom下的光盘镜像到/mnt 下
把挂载的光盘镜像内的文件导入cobbler
wKiom1RDNE2yzWV9AABuj7CIHDw204.jpg
导入过程要多等一会....................................
完成后查看cobbler distro list 是否有导入的文件

5)提供profile文件
创建profile文件依赖于kickstart. 所以要先提供kickstart文件
创建kickstart请参考pxe安装
正式创建profile
1
cobbler profile add --name=centos-6.5-x86_64-basic --distro=centos-6.5-x86_64 --kickstart=/root/centos6.x86_64.cfg



查看创建有哪些profile第一个为创建distro时自动创建的做基本的profile.第二个为自己新增加创建的profile
wKioL1RDNPaxn3MXAAJLIoPwhF8426.jpg
导入完成以后执行cobbler sync 下 sync后会在/var/lib/tftpboot/pxelinux.cfg 自动创建一个default文件
查看下此文件
wKiom1RDNTTA-7tBAADEBAyM9vs141.jpg
6)新创建虚拟机进行安装
  安装系统选择
wKiom1RDNYyBKZMFAAD1NVajreg375.jpg
成功进入安装界面

wKioL1RDNtKRF1HnAAAtOoEqALM937.jpg
注:重新修改安装配置的话要重新加载一下cobbler
1
例:cobbler profile edit --name=centos-6.5-x86_64-basic --distro=centos-6.5-x86_64 --kickstart=/root/centos6.x86_64.cfg



修改profit文件后需要从新加载一下 cobbler sync


7)安装cobbler的WEB管理

1
2
yum -y cobbler-web
   vim /etc/cobbler/modules.conf



wKioL1RDNx7AXI_bAAEARwtXtgg655.jpg
添加cobbler用户添加cobbler密码
wKioL1RDN2GzZg3VAAAyNdAXrME156.jpg
编辑/etc/cobbler/users.conf配置文件
wKiom1RDN4PT4oAoAADhApYjj4c488.jpg
重启cobblerd
1
service cobblerd restart



重启一下httpd
1
service  httpd restart




OK cobbler配置已经完成


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-26243-1-1.html 上篇帖子: CentOS6.x maven安装教程 下篇帖子: Ubuntu 12.04.4 LTS 多版本库svn独立服务器搭建 linux
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表