cobbler批量安装linux(centos6.5)
1.安装 cobbler
(1).安装第三方软件库所需要的包
#cd /tmp
#wget http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
#rpm -ivh epel-release-6-8.noarch.rpm
(2).安装 dhcp
#yum -y install dhcp
(3). 安装其他的相关软件
#yum -y install tftp rsync xinetd httpd
(4). 安装 cobbler
#yum -y install cobbler
2.关闭 selinux 和 防火墙
#setenforce 0
#service iptables stop
3.启动 cobbler及相关服务
#service httpd start
#chkconfig httpd on
#service cobblerd start
#chkconfig cobblerd on
4.设置 cobbler
(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 : 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 : 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 : debmirror package is not installed, it will be required to manage debian deployments and repositories
7 : ksvalidator was not found, install pykickstart
8 : 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
9 : 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怎么做
修改这个/etc/cobbler/settings配置文件中的server参数为本服务器的ip
说明下2怎么做
修改这个/etc/cobbler/settings配置文件中的next_server参数为本服务器的ip
说明下3怎么做
如果你开启了selinux这个安全东西,需要关闭它
#setenforce 0
或者修改配置文件/etc/selinux/config中的SELINUX=disabled,这一步需要重启操作系统
说明下4怎么做
#cobbler get-loaders
说明下5怎么做
修改配置文件/etc/xinetd.d/rsync中的disable = no
说明下6怎么做(其实6可以不做)
#yum -y install ed patch perl perl-Digest-SHA1 perl-libwww-perl perl-Compress-Zlib perl-LockFile-Simple
#rpm -ivh debmirror-20090807-1.el5.noarch.rpm
#vim /etc/debmirror.conf
注释以下两行
#@dists="sid";
#@arches="i386";
说明下7怎么做
#yum -y install pykickstart
说明下8怎么做
修改cobbler用户的默认密码,可以用如下命令生成密码,并使用生成后的密码替换/etc/cobbler/settings中的密码,找到这一行default_password_crypted
以下是生成密码的命令
#openssl passwd -1 -salt ‘daoke‘ ‘mirrtalk‘
会产生如下密码
$1$daoke$p2T8SDDadwH.qOeQIUeUR/
替换即可
修改过程中,多次使用cobbler check查看,知道所有的问题解决
(3)重启cobbler并应用应用所有的设置
#service cobblerd restart
#cobbler sync
5.修改DHCP模板,确保DHCP分配的地址和cobbler在同一个网段,记得修改/etc/cobbler/settings的参数manage_dhcp 设为 1,以便管理 DHCP
vim /etc/cobbler/dhcp.template
# ******************************************************************
# Cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
#
# ******************************************************************
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.5.0 netmask 255.255.255.0 {
option routers 192.168.5.2;
option domain-name-servers 192.168.5.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.5.110 192.168.5.220;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option pxe-system-type = 00:02 {
filename "ia64/elilo.efi";
} else if option pxe-system-type = 00:06 {
filename "grub/grub-x86.efi";
} else if option pxe-system-type = 00:07 {
filename "grub/grub-x86_64.efi";
} else {
filename "pxelinux.0";
}
}
}
#for dhcp_tag in $dhcp_tags.keys():
## group could be subnet if your dhcp tags line up with your subnets
## or really any valid dhcpd.conf construct ... if you only use the
## default dhcp tag in cobbler, the group block can be deleted for a
## flat configuration
# group for Cobbler DHCP tag: $dhcp_tag
group {
#for mac in $dhcp_tags[$dhcp_tag].keys():
#set iface = $dhcp_tags[$dhcp_tag][$mac]
host $iface.name {
hardware ethernet $mac;
#if $iface.ip_address:
fixed-address $iface.ip_address;
#end if
#if $iface.hostname:
option host-name "$iface.hostname";
#end if
#if $iface.netmask:
option subnet-mask $iface.netmask;
#end if
#if $iface.gateway:
option routers $iface.gateway;
#end if
#if $iface.enable_gpxe:
if exists user-class and option user-class = "gPXE" {
filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner";
} else if exists user-class and option user-class = "iPXE" {
filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner";
} else {
filename "undionly.kpxe";
}
#else
filename "$iface.filename";
#end if
## Cobbler defaults to $next_server, but some users
## may like to use $iface.system.server for proxied setups
next-server $next_server;
## next-server $iface.next_server;
}
#end for
}
#end for
注意!!!!
vim /etc/dhcp/dhcpd.conf
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.5.0 netmask 255.255.255.0 {
option routers 192.168.5.2;
option domain-name-servers 192.168.5.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.5.110 192.168.5.220;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.5.132;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option pxe-system-type = 00:02 {
filename "ia64/elilo.efi";
} else if option pxe-system-type = 00:06 {
filename "grub/grub-x86.efi";
} else if option pxe-system-type = 00:07 {
filename "grub/grub-x86_64.efi";
} else {
filename "pxelinux.0";
}
}
}
group {
}
启动dhcp及开机自动启动
#service dhcpd start
#chkconfig dhcpd on
6.挂在centos6.5安装盘,生成安装镜像
#mkdir /mnt/mirrtalk65miso/
#mount -o loop /data/mirrtalk-6.5-x86_64-minimal.iso /mnt/mirrtalk65miso/
#cobbler import --path=/mnt/mirrtalk65miso/ --name=mirrtalk-6.5-x86_64 --arch=x86_64
查看已导入的
#cobbler distro list
#cobbler list
#cobbler report
7.修改mirrtalk65miso.ks
#vim /var/lib/cobbler/kickstarts/mirrtalk65miso.ks
auth --useshadow --enablemd5
bootloader --location=mbr
clearpart --all --initlabel
text
firewall --disabled
firstboot --disabled
keyboard us
lang en_US.UTF-8
network --onboot yes --bootproto dhcp --noipv6
url --url=$tree
$yum_repo_stanza
reboot
rootpw mirrtalk
selinux --disabled
skipx
timezone --utc Asia/Shanghai
install
zerombr yes
part /boot --fstype ext4 --size=200 --asprimary
part / --fstype ext4 --size=102400
part swap --size=16384
part /data --fstype ext4 --size=100 --grow
reboot
%packages
@core
@server-policy
@workstation-policy
%end
8.修改显示界面
#vim /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://www.cobblerd.org/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local
LABEL mirrtalk-6.5-x86_64
kernel /images/mirrtalk-6.5-x86_64/vmlinuz
MENU LABEL mirrtalk-6.5-x86_64
append initrd=/images/mirrtalk-6.5-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.5.132/cblr/svc/op/ks/profile/mirrtalk-6.5-x86_64
ipappend 2
MENU end
重启相关服务
#/etc/init.d/xinetd restart
#/etc/init.d/cobblerd restart
指定某个profile的ks文件
#cobbler profile add --name=mirrtalk-6.5-x86_64 kickstart=/var/lib/cobbler/kickstarts/mirrtalk65miso.ks
#cobbler profile edit --name=mirrtalk-6.5-x86_64 kickstart=/var/lib/cobbler/kickstarts/mirrtalk65miso.ks
9.重启
#/etc/init.d/cobblerd restart
本文出自 “孟郎” 博客,请务必保留此出处http://19871124.blog.51cto.com/624660/1431394
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。