Cobbler 全自动化安装简介Web界面管理附送源码包

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cobbler 全自动化安装简介Web界面管理附送源码包相关的知识,希望对你有一定的参考价值。

Cobbler简介


Cobbler这个英文翻译过来的意思是补鞋匠,为什么会是补鞋匠的意思,很简单,因为它简单得连补鞋匠都能学会安装系统。

Cobbler通过将部署系统所涉及的所有服务集中在一起,来提供一个全自动批量快速建立Linux系统的网络安装环境。

在学习Cobbler之前可以看看PXE无人值守安装系统


Cobbler特点:

·Cobbler支持多种Linux操作系统得快速部署,对PXE、DHCP、HTTP、TFTP、Kiskstart、YUM仓库、电源等进行统一管理

·Cobbler提供实现不同用户需求得可定制系统部署方案

·Cobbler分别提供命令管理和Web界面管理、方便Cobbler管理员使用。


部署准备:

·VMware虚拟机

·Cobbler服务器(我这里是Ctenos7)

·在虚拟机中网络连接改为NAT模式、IP地址为:192.168.106.131

·Cobbler源码包epel-release-latest-7.noarch.rpm 密码:9sxj


部署开始:

·安装epel-release-latest-7.noarch软件包(Cobbler是由这个软件包提供服务得,源码包在准备前提供了连接。可以用共享或者其他工具存放到 Linux中

[[email protected] ~]# rpm -ivh epel-release-latest-7.noarch.rpm 


·挂载自己的镜像文件到 /mnt 目录下

[[email protected] ~]# mount /dev/sr0 /mnt


·因为后面需要用YUM安装服务,这里需要重新加载YUM仓库

[[email protected] ~]# yum list


·安装cobbler cobbler-web dhcp tftp-sever pykickstart httpd rsync xinetd服务,这些包都需要安装哦!

[[email protected] ~]# yum install cobbler cobbler-web dhcp tftp-sever pykickstart httpd rsync xinetd -y


·修改cobbler主配置文件

[[email protected] ~]# vim /etc/cobbler/settings


next_server: 192.168.106.131     #指定cobbler服务器地址

server:192.168.106.131            #指定TFTP服务器地址(因为tftp在cobbler中,所以指向的地址都一样)

manage_dhcp: 1     #把对dhcp管理服务开启(1:开启 0:关闭)


·启动httpd服务、启动Cobblerd服务、关闭防火墙、光比增强×××

[[email protected] ~]# systemctl start httpd.service

[[email protected] ~]# systemctl start cobblerd.service

[[email protected] ~]# systemctl disable firewalld.service

[[email protected] ~]# setenforce 0


·对cobbler做检查设置

[[email protected] ~]# cobbler check


1 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:

    https://github.com/cobbler/cobbler/wiki/Selinux

2 : change 'disable' to 'no' in /etc/xinetd.d/tftp

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 : enable and start rsyncd.service with systemctl

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


·接下来我们需要对上述检查结果进行修改。修改tftp配置文件

[[email protected] ~]# vim /etc/xinetd.d/tftp

disable                 = no#开启tftp服务


·启动远程同步服务、重启cobbler服务

[[email protected] ~]# systemctl enable rsyncd.service

[[email protected] ~]# systemctl restart cobblerd.service


·设置盐值加密(就是给客户机root的密码),会出现一串加密字符,把字符添加到cobbler主配置文件相应的位置

[[email protected] ~]# openssl passwd -1 -salt 'abc123' 'abc123'

$1$abc123$9v8z2./E/PZihXrVcy3II0


·把生成的密码复制到以下配置文件中

[[email protected] ~]# vim /etc/cobbler/settings


default_password_crypted: "$1$abc123$9v8z2./E/PZihXrVcy3II0"


·重启xinetd服务

[[email protected] ~]# systemctl restart xinetd.service


·修改被cobbler所管理的dhcp模板


subnet 192.168.106.0 netmask 255.255.255.0 {    #指定自己的网段

     option routers             192.168.106.1;#修改网关

     option domain-name-servers 192.168.106.2;#修改DNS

     option subnet-mask         255.255.255.0;

     range dynamic-bootp        192.168.106.100 192.168.106.200;#修改地址池


·同步生成DHCP配置文件

[[email protected] ~]# cobbler sync


·下载引导操作系统文件


[[email protected] ~]# cobbler get-loaders


·在过程中,我们不一定知道那些服务启动、或者修改了忘记重启,就干脆全部重启一次。

[[email protected] ~]# systemctl start dhcpd.service    //启动dhcp

[[email protected] ~]# systemctl start cobblerd.service    //启动cobbler

[[email protected] ~]# systemctl start xinetd.service     //启动tftp


·在开始之前我们就把镜像文件挂载到了/mnt 目录下,现在需要把镜像文件导入cobbler默认存在的位子

[[email protected] ~]# cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64    //文件较大,需要等待


/var/www/cobbler/ks_mirror/CentOS-7-x86_64    //导入的镜像文件存放的位子


·使用cobbler list 查看发行版本,和模板

[[email protected] ~]# cobbler list

distros:

   CentOS-7-x86_64


profiles:

   CentOS-7-x86_64



·可以安装一个软件tree,来查看压缩内核与引导文件

[[email protected] ~]# yum install tree -y

[[email protected] ~]# tree /var/lib/tftpboot/images

技术分享图片


·添加配置让cobbler受web管理,这样方便。添加一个管理者(cbamin)到指定的路径下

[[email protected] ~]# htdigest -c /etc/cobbler/users.digest cobbler cbadmin

技术分享图片

验证自动化安装:

重启所有服务、在VMware新建一台Linux。如下图:

技术分享图片

技术分享图片

技术分享图片

技术分享图片

技术分享图片

到此几乎不出意外就没问题了。

验证web管理:

技术分享图片

实验成功!





以上是关于Cobbler 全自动化安装简介Web界面管理附送源码包的主要内容,如果未能解决你的问题,请参考以下文章

cobbler自动化安装平台

CentOS 7搭建Cobbler批量自动安装系统

图文详解cobbler 自动装机教程

COBBLER无人值守安装

Cobbler自动装机试验

运维自动化工具 Cobbler