CentOS6.5部署Cobbler服务器

前端之家收集整理的这篇文章主要介绍了CentOS6.5部署Cobbler服务器前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

安装基本环境(可忽略)

yumgroupinstall"Compatibilitylibraries""Base""Developmenttools""debuggingTools""Dial-upNetworkingSupport"
yuminstalltreenmapsysstatlrzszdos2unix-y


建议使用清华源

[root@localhost~]#yuminstallepel-release#安装epel源


安装cobbler程序包

[root@localhost~]#yuminstallcobblerdhcptftp-serverpykickstarthttpd


启动Cobbler等程序

[root@localhost~]#setenforce0
[root@localhost~]#serviceiptablesstop;chkconfigiptablesoff
[root@localhost~]#chkconfigcobblerdon
[root@localhost~]#chkconfighttpdon;servicehttpdrestart


配置Cobbler程序

[root@localhostyum.repos.d]#cobblercheck


解决报错

第一步+第二步
[root@localhost~]#cat-n/etc/cobbler/settings
272next_server:192.168.1.1
384server:192.168.1.1
242manage_dhcp:1
第三步:
[root@localhost~]#cat-n/etc/selinux/config
7SELINUX=disabled
第四步:
[root@localhost~]#vim/etc/xinetd.d/tftp
14disable=no
第五步:
[root@localhost~]#cobblerget-loaders
第六步:
[root@localhost~]#cat-n/etc/xinetd.d/rsync
6disable=no
[root@localhost~]#servicexinetdrestart
[root@localhost~]#chkconfigxinetdon
第七步:这是个BUG
[root@localhost~]#yuminstalldebmirror-y
[root@localhost~]#vim/etc/debmirror.conf
28#@dists="sid";
29@sections="main,main/debian-installer,contrib,non-free";
30#@arches="i386";
第九步:
[root@localhost~]#opensslpasswd-1-salt'suijishuru''Cobb_01!'
$1$suijishu$J0AUTQIBV0QGeZvVkIT0G.
[root@localhost~]#cat/etc/cobbler/setting
101default_password_crypted:"$1$suijishu$J0AUTQIBV0QGeZvVkIT0G."
第十步:
[root@localhost~]#yuminstallfence-agents-y##这个工具会安装一些硬件管理工具,ipmitools等


配置DHCP

这里在之前已经开启了manage_dhcp,所以需要修改cobbler下的dhcp模板,不能修改dhcp的默认配置文件,因为修改cobbler的模板后,cobbler sync后会将cobbler-dhcp模板里的信息写入到dhcp默认配置文件


[root@localhost~]#vim/etc/cobbler/dhcp.template
21subnet192.168.1.0netmask255.255.255.0{
22optionrouters192.168.1.1;
23optiondomain-name-servers8.8.8.8;
24optionsubnet-mask255.255.255.0;
25rangedynamic-bootp192.168.1.100192.168.1.220;


同步cobbler,并再次检查

[root@localhost~]#cobblersync
[root@localhost~]#servicecobblerdrestart
[root@localhost~]#cobblercheck


测试Cobbler是否可进行引导

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

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

Cobbler命令获取帮助

导入放置ISO镜像

[root@localhost~]#mount/dev/cdrom/mnt
[root@localhost~]#cobblerimport--path=/mnt/--name=CentOS-7.2-x86_64--arch=x86_64
[root@localhost~]#cobblerimport--path=/mnt/--name=CentOS-6.5-x86_64--arch=x86_64##需要再次挂载

查看当前cobbler发行镜像列表

[root@localhost~]#cobblerdistrolist##这里的列表应该和cobbler显示界面的是一致的
CentOS-6.5-x86_64
CentOS-7.2-x86_64
images-x86_64

查看cobbler列表里的镜像的cobbler参数配置

[root@localhostkickstarts]#cobblerprofilereport
Name:CentOS-7.2-x86_64
TFTPBootFiles:{}
Comment:
DHCPTag:default
Distribution:CentOS-7.2-x86_64
EnablegPXE?:0
EnablePXEMenu?:1
FetchableFiles:{}
KernelOptions:{}
KernelOptions(PostInstall):{}
Kickstart:/var/lib/cobbler/kickstarts/sample_end.ks##无人值守文件
KickstartMetadata:{}
ManagementClasses:[]
ManagementParameters:<<inherit>>
NameServers:[]
NameServeRSSearchPath:[]
Owners:['admin']
ParentProfile:
Internalproxy:
RedHatManagementKey:<<inherit>>
RedHatManagementServer:<<inherit>>
Repos:[]
ServerOverride:<<inherit>>
TemplateFiles:{}
VirtAutoBoot:1
VirtBridge:xenbr0
Virtcpus:1
VirtDiskDriverType:raw
VirtFileSize(GB):5
VirtPath:
VirtRAM(MB):512
VirtType:kvm

Distribution:CentOS-6.5-x86_64
EnablegPXE?:0
EnablePXEMenu?:1
FetchableFiles:{}
KernelOptions:{}
KernelOptions(PostInstall):{}
Kickstart:/var/lib/cobbler/kickstarts/sample_end.ks
KickstartMetadata:{}
ManagementClasses:[]
ManagementParameters:<<inherit>>
NameServers:[]
NameServeRSSearchPath:[]
Owners:['admin']
ParentProfile:
Internalproxy:
RedHatManagementKey:<<inherit>>
RedHatManagementServer:<<inherit>>
Repos:[]
ServerOverride:<<inherit>>
TemplateFiles:{}
VirtAutoBoot:1
VirtBridge:xenbr0
Virtcpus:1
VirtDiskDriverType:raw
VirtFileSize(GB):5
VirtPath:
VirtRAM(MB):512
VirtType:kvm


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

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

cobblerprofileedit--name=CentOS-6.5-x86_64--kickstart=/var/lib/cobbler/kickstarts/Centos6.5.cfg

Centos7指定无人值守文件,并修改内核使网卡接口更改为eth0

cobblerprofileedit--name=CentOS-7.2-x86_64--kickstart=/var/lib/cobbler/kickstarts/CentOS7.2.cfg--kopts='net.ifnames=0biosdevname=0'


指定完kickstart文件后,即可实现无人值守安装,如果不指定自定义的kickstart文件默认使用/var/lib/cobbler/kickstarts/下的sample_end.ks来无人值守安装


关于kickstart文件小技巧

[root@localhostkickstarts]#vimCentos6.5.cfg
...
url--url=$tree
#url--url="http://192.168.1.1/CentOS-6.5-X86_64"
...
可以不再使用网络路径,不再手动指定路径

...
rootpw--iscrypted$default_password_crypted
#rootpw--iscrypted$1$Wpkdx1Ru$Uw8R9RAJV6fbt/Gm1trwj0
...
调用/etc/cobbler/settings里的default_password_crypted密码

...
unsupported_hardware该参数可以忽略对硬件的检查
...


补充一下吧,关于自动化部署,其实还可以依赖pxe的方式,但是相对pxe的方式操作太过复杂,并且功能不如cobbler强大,cobbler可以部署多种版本linux,但是无人值守是需要kickstart作支持

原文链接:https://www.f2er.com/centos/375128.html

猜你在找的CentOS相关文章