CentOS6.5部署Cobbler服务器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS6.5部署Cobbler服务器相关的知识,希望对你有一定的参考价值。

# Cobbler的部署及使用

## 安装基本环境

yum groupinstall "Compatibility libraries" "Base" "Development tools" "debugging Tools" "Dial-up Networking Support"
yum install tree nmap sysstat lrzsz dos2unix -y

Compatibility libraries:包含openLDAP和openmpi等等

base:常用的软件包,lrzsz,ntp等等

Development tools:包含gcc,cmake等等

debugging Tools:latrace,lslk等


## 配置yum源



 

## 安装cobbler程序包

[[email protected] ~]# yum install cobbler dhcp tftp-server pykickstart httpd  #这里不安装cobbler-web,缺少Django


## 启动Cobbler等程序

[[email protected] ~]# setenforce 0

[[email protected] ~]# service iptables stop

[[email protected] ~]# chkconfig iptables off

[[email protected] ~]# chkconfig cobblerd on

[[email protected] ~]# chkconfig httpd on

[[email protected] ~]# service httpd restart

Starting httpd: 

[[email protected] yum.repos.d]# service cobblerd restart

Starting cobbler daemon:                                   [  OK  ]

## 配置Cobbler程序

[[email protected] yum.repos.d]# 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 : 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

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

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/rsync

7 : file /etc/xinetd.d/rsync does not exist

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

10 : 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.



### 解决办法:

第一步+第二步

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

272 next_server: 192.168.1.1

384 server: 192.168.1.1

242 manage_dhcp: 1


第三步:

[[email protected] ~]# cat -n /etc/selinux/config

7 SELINUX=disabled

第四步:

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

14 disable = no

第五步:

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

第六步:

[[email protected] ~]# cat -n /etc/xinetd.d/rsync

     6 disable = no

[[email protected] ~]# service xinetd restart

[[email protected] ~]# chkconfig xinetd on

第七步:这是个BUG

第八步:yum install debmirror -y 

[[email protected] ~]# vim /etc/debmirror.conf

28 #@dists="sid";

 29 @sections="main,main/debian-installer,contrib,non-free";

 30 #@arches="i386";

第九步:

[[email protected] ~]# openssl passwd -1 -salt 'suijishuru' 'Cobb_01!'

$1$suijishu$J0AUTQIBV0QGeZvVkIT0G.

[[email protected] ~]# cat /etc/cobbler/setting

101 default_password_crypted: "$1$suijishu$J0AUTQIBV0QGeZvVkIT0G."

第十步:

[[email protected] ~]# yum install fence-agents -y ##这个工具会安装一些硬件管理工具,ipmitools等

### 配置DHCP

[[email protected] ~]# vim /etc/cobbler/dhcp.template

21 subnet 192.168.1.0 netmask 255.255.255.0 {

 22      option routers             192.168.1.1;

 23      option domain-name-servers 8.8.8.8;

 24      option subnet-mask         255.255.255.0;

 25      range dynamic-bootp        192.168.1.100 192.168.1.220;


做完以上十步重启cobbler

[[email protected] ~]# cobbler sync

[[email protected] ~]# service cobblerd restart

[[email protected] ~]# cobbler check


The following are potential configuration items that you may want to fix:


1 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:     ##BUG重启机器即可

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

2 : file /etc/xinetd.d/rsync does not exist   ##BUG

测试Cobbler是否正常

注意关闭VMware里虚拟网络编辑器里的DHCP功能

![](http://i2.51cto.com/images/blog/201712/02/8a4dc6303e9a77fbdb5eb3a5fdbe97a6.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)

测试新建虚拟机,网卡模式与Cobbler一个通道,设置网络启动

 

## Cobbler命令介绍

![](http://i2.51cto.com/images/blog/201712/02/47fbbcb8c327a17a77e696e84c3c72cf.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)


## 导入放置ISO镜像

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

[[email protected] ~]# cobbler import --path=/mnt/ --name= CentOS-7.2-x86_64 --arch=x86_64

[[email protected] ~]# cobbler import --path=/mnt/ --name= CentOS-6.5-x86_64 --arch=x86_64


 

### 查看当前cobbler发行镜像列表

[[email protected] ~]# cobbler distro list

   CentOS-6.5-x86_64

   CentOS-7.2-x86_64

   images-x86_64

实现自动化部署:

 

查看默认配置

[[email protected] kickstarts]# cobbler profile report

Name                           : CentOS-7.2-x86_64

TFTP Boot Files                : {}

Comment                        : 

DHCP Tag                       : default

Distribution                   : CentOS-7.2-x86_64

Enable gPXE?                   : 0

Enable PXE Menu?               : 1

Fetchable Files                : {}

Kernel Options                 : {}

Kernel Options (Post Install)  : {}

Kickstart                      : /var/lib/cobbler/kickstarts/sample_end.ks

Kickstart Metadata             : {}

Management Classes             : []

Management Parameters          : <<inherit>>

Name Servers                   : []

Name Servers Search Path       : []

Owners                         : ['admin']

Parent Profile                 : 

Internal 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                      : kvm


Distribution                   : CentOS-6.5-x86_64

Enable gPXE?                   : 0

Enable PXE Menu?               : 1

Fetchable Files                : {}

Kernel Options                 : {}

Kernel Options (Post Install)  : {}

Kickstart                      : /var/lib/cobbler/kickstarts/sample_end.ks

Kickstart Metadata             : {}

Management Classes             : []

Management Parameters          : <<inherit>>

Name Servers                   : []

Name Servers Search Path       : []

Owners                         : ['admin']

Parent Profile                 : 

Internal 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                      : kvm


实现自动化安装,指定ks.cfg文件

/var/lib/cobbler/kickstarts ##无人值守文件存放目录

Cobbler profile edit –help ##获取帮助

 

Centos7修改内核更改为eth0

 

# 制作kickstart文件

安装程序包

[[email protected] ~]# yum isntall system-config-kickstart

[[email protected] ~]# system-config-kickstart

图形化配置:

https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/6/html/installation_guide/ch-redhat-config-kickstart

自定义配置:

https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/6/html/installation_guide/s1-kickstart2-options


以上是关于CentOS6.5部署Cobbler服务器的主要内容,如果未能解决你的问题,请参考以下文章

Centos 部署Cobbler系统

自动化安装linux--cobbler

Cobbler-自动化部署神器

cobbler部署

Cobbler自动部署装机

cobbler部署