您的位置:首页 > 运维架构 > Linux

自动化安装linux--cobbler

2016-02-25 14:35 405 查看
因为公司前期已经部署好cobbler,现在需要导入新封装的操作系统。关键就是导入!!以前也没接触过cobbler,所以就部署一次!!。清楚里面的流程以及原理。。。。

一、cobbler环境

系统为 centos 6.5 ip:192.168.10.38 自动安装系统为centos6.5 1、安装前准备 准备首先安装epel-release yum install epel-release
然后需要关掉selinux:

vim /etc/selinux/config 将selinux的值改为distabled
关掉iptables chkconfig iptables off 重新启动系统使其生效。

2、安装必要服务
(1)cobbler (cobbler的核心)
(2)httpd (提供cobbler的web界面)
(3)dhcpd (为自动安装系统分配IP地址)
(4)epel-release (为之提供yum源)
(5)rsync (cobbler需要同步信息)
(6)cobbler-web (cobbler的一个web插件)
(7)xinetd (为rsync和tftp的守护进程)
(8)tftp (传送安装的一些文件的类似ftp)
开始安装 yum install cobbler httpd rsync tftp-server xinetd dhcp cobbler-web

3、启动必要服务启动服务:/etc/init.d/httpd restart
会出现:、
Starting httpd: httpd: apr_sockaddr_info_get() failed for Gitlab-test
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
需要修改:vim /etc/httpd/conf/httpd.conf
ServerName:127.0.0.1
再次重启httpd就ok了!!

启动cobbler服务
/etc/init.d/cobblerd restart

二、检查bug

1、用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 : change 'disable' to 'no' in /etc/xinetd.d/tftp
4 : 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.
5 : change 'disable' to 'no' in /etc/xinetd.d/rsync
6 : file /etc/xinetd.d/rsync does not exist
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : ksvalidator was not found, install pykickstart
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.

2、解决问题

(1)、修改cobbler主配置文件
vim /etc/cobbler/settings
next_server: 192.168.10.38

server:192.168.10.38
manage_dhcp: 1
manage_rsync:1
保存退出
重新启动cobblerd服务: service cobblerd restart

(2)、修改xinetd文件
vim /etc/xinetd.d/tftp
将disable的值改为no
vim /etc/xinetd.d/rsync
将disable的值改为no

再次cobbler check
The following are potential configuration items that you may want to fix:

1 : dhcpd is not installed
2 : 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.
3 : file /etc/xinetd.d/rsync does not exist
4 : debmirror package is not installed, it will be required to manage debian deployments and repositories
5 : ksvalidator was not found, install pykickstart
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

Restart cobblerd and then run 'cobbler sync' to apply changes.
错误:说dhcpd没有安装
(3)、修改cobbler 内嵌的dhcpd模块
vim /etc/cobbler/dhcp.template

ddns-update-style interim;

allow booting;
allow bootp;

ignore client-updates;
set vendorclass = option vendor-class-identifier;

option pxe-system-type code 93 = unsigned integer 16;

subnet 192.168.10.0 netmask 255.255.255.0 {
option routers 192.168.10.5;
option domain-name-servers 192.168.10.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.10.100 192.168.10.254;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
其他的就可以默认了。。
通过cobbler sync 来启动dhcpd服务

当运行完cobbler sync最终会出现:

*** TASK COMPLETE ***
说明没有问题!!!!

(4)、此时下载数据用:
cobbler get-loaders
同样会出现
*** TASK COMPLETE ***

按照上述提供的错误:debmirror 是当安装debian系统需要的文件。看着不爽可以yum安装

(5)、安装debmirror
yum install debmirror

需要修改: vim /etc/debmirror.conf
注释掉两行
#@dists="sid";
@sections="main,main/debian-installer,contrib,non-free";
#@arches="i386";
保存退出
(6)安装cman和pykickstart
yum install cman 为了消除那个fencing tools
yum install pykickstart

(7)生成密码
此时还需要生成个密码:openssl passwd -1 -salt 'cobbler'
输入密码生成的密码复制到/etc/cobbler/settings
defaults_password那个选项

三、访问
重新启动cobbler
此时就剩下一个没有rsync文件了。但是实际存在的。没关系不用管他
你可以去访问了:http://192.168.10.38/cobbler_web
密码和用户都是:cobbler

四、后台导入DVD
前提挂载镜像: mount -o loop /tmp/****.iso /tmp/dvd
cobbler import --path=/tmp/dvd --name=任意 --arch=X86_64
会需要点时间,耐心等待!!

五、web页面导入
import DVD
name=规范写
架构

系统
path=挂载的路径

profile 那要选取一下安装的ks文件

目前我只负责到这。他们后续负责安装系统!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux 自动化 cobbler