码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS6.5部署Cobbler服务器

时间:2017-12-02 21:06:59      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:cobbler   linux   自动化   

# 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程序包

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


## 启动Cobbler等程序

[root@localhost ~]# setenforce 0

[root@localhost ~]# service iptables stop

[root@localhost ~]# chkconfig iptables off

[root@localhost ~]# chkconfig cobblerd on

[root@localhost ~]# chkconfig httpd on

[root@localhost ~]# service httpd restart

Starting httpd: 

[root@localhost yum.repos.d]# service cobblerd restart

Starting cobbler daemon:                                   [  OK  ]

## 配置Cobbler程序

[root@localhost 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.



### 解决办法:

第一步+第二步

[root@localhost ~]# cat /etc/cobbler/settings

272 next_server: 192.168.1.1

384 server: 192.168.1.1

242 manage_dhcp: 1


第三步:

[root@localhost ~]# cat -n /etc/selinux/config

7 SELINUX=disabled

第四步:

[root@localhost ~]# vim /etc/xinetd.d/tftp

14 disable = no

第五步:

[root@localhost ~]# cobbler get-loaders

第六步:

[root@localhost ~]# cat -n /etc/xinetd.d/rsync

     6 disable = no

[root@localhost ~]# service xinetd restart

[root@localhost ~]# chkconfig xinetd on

第七步:这是个BUG

第八步:yum install debmirror -y 

[root@localhost ~]# vim /etc/debmirror.conf

28 #@dists="sid";

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

 30 #@arches="i386";

第九步:

[root@localhost ~]# openssl passwd -1 -salt 'suijishuru' 'Cobb_01!'

$1$suijishu$J0AUTQIBV0QGeZvVkIT0G.

[root@localhost ~]# cat /etc/cobbler/setting

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

第十步:

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

### 配置DHCP

[root@localhost ~]# 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

[root@localhost ~]# cobbler sync

[root@localhost ~]# service cobblerd restart

[root@localhost ~]# 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镜像

[root@localhost ~]# mount /dev/cdrom /mnt

[root@localhost ~]# cobbler import --path=/mnt/ --name= CentOS-7.2-x86_64 --arch=x86_64

[root@localhost ~]# cobbler import --path=/mnt/ --name= CentOS-6.5-x86_64 --arch=x86_64


 

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

[root@localhost ~]# cobbler distro list

   CentOS-6.5-x86_64

   CentOS-7.2-x86_64

   images-x86_64

实现自动化部署:

 

查看默认配置

[root@localhost 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文件

安装程序包

[root@localhost ~]# yum isntall system-config-kickstart

[root@localhost ~]# 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服务器

标签:cobbler   linux   自动化   

原文地址:http://blog.51cto.com/swiki/2046814

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!