【问题描述】:

很早之前使用笔记本的虚拟机安装过cobbler批量安装系统,后来离职,电脑还给上家公司,现在新公司也有批量安装系统需求,于是在新笔记本的虚拟机安装cobbler,安装过程是按照之前的笔记,按理说没有问题,但是安装完毕后,新建一个虚拟机模拟装机,发现报如下错误:

Nothing to boot: No such file or directory (http://ipxe.org/2d03e13b)”.

且报错上面的信息显示虚拟机已经获得了dhcp分配的IP地址。

查询资料也没找到解决办法,开始觉得应该tftp的问题,但是看了很多文章,也查看了配置,觉得并没有配置上的错误。

【解决思路】:

后来参考了下面博客里面的文章,重启安装cobbler,一切问题解决,反思这篇文章和我笔记的不同点是,他的dns和dhcp的管理采用dnsmasq管理的。

参考博客:http://www.chenshake.com/centos6-4-installation-and-configuration-cobbler-2-4/

下面贴出我根据这篇文件简练后的配置,和原文有一些不同,仅供遇到同样问题的人参考一下:

1.初始化设置:
CentOS6.5,最小化安装
设置机器的hostname和FQDN名字
设置使用源和epel源 http://mirrors.ustc.edu.cn/
关闭selinux 和防火墙 http://www.chenshake.com/linux-foundation-closing-selnux/
设置网络,使用静态IP。

2.安装Cobbler:
直接运行下面命令,把所有需要的包都装上
yum -y install cman tftp-server cobbler cobbler-web pykickstart debmirror dnsmasq

启动相关服务
chkconfig httpd on
chkconfig cobblerd on
chkconfig dnsmasq on
/etc/init.d/httpd restart
/etc/init.d/cobblerd restart
/etc/init.d/dnsmasq restart

3. 配置Cobbler
3.1 tftp服务和rsync服务
sed -i ‘/disable/ctdisablettt= no’ /etc/xinetd.d/tftp
sed -i -e ‘s/= yes/= no/g’ /etc/xinetd.d/rsync
service xinetd restart

3.2 启动菜单
cobbler get-loaders

3.3 设置debmirror
sed -i -e ‘s|@dists=.*|#@dists=|’ /etc/debmirror.conf
sed -i -e ‘s|@arches=.*|#@arches=|’ /etc/debmirror.conf

3.4 编辑dnsmasq.template 模板
vi /etc/cobbler/dnsmasq.template
# Cobbler generated configuration file for dnsmasq
# $date
#

# resolve.conf .. ?
#no-poll
#enable-dbus
read-ethers
addn-hosts = /var/lib/cobbler/cobbler_hosts

dhcp-range=172.28.1.10,172.28.1.250
#dhcp-ignore=tag:!known
#dhcp-ignore=#known (dhcp-ignore,这个参数是为了如果不是我运行的mac地址,就忽略)
#no-dhcp-interface=eth1
server=114.114.114.114
dhcp-option=3,$next_server
dhcp-lease-max=1000
dhcp-authoritative
dhcp-boot=pxelinux.0
dhcp-boot=net:normalarch,pxelinux.0
dhcp-boot=net:ia64,$elilo
$insert_cobbler_system_definitions

3.5设置模块
让cobbler去管理dnsmasq。默认他是使用bind管理dns,isc实现dhcp。
vi /etc/cobbler/modules.conf

[dns] #module = manage_bind
module = manage_dnsmasq[dhcp] #module = manage_isc
module = manage_dnsmasq

3.6 动态更新设置
对于Cobbler2.4来说,有一个重要的功能,就是让你可以不需要手工去编辑setting配置文件,直接使用命令去修改,默认这个功能是不启用,你需要启用。
cd /etc/cobbler/
cp settings settings.save
sed -i ‘s/^[[:space:]]+/ /’ /etc/cobbler/settings
sed -i ‘s/allow_dynamic_settings: 0/allow_dynamic_settings: 1/g’ /etc/cobbler/settings

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

修改seting文件

cobbler登陆服务器地址
cobbler setting edit –name=server –value=本机IP

ks脚本关闭pxe,这样就不会重复安装
cobbler setting edit –name=pxe_just_once –value=1

TFTP服务器 IP地址
cobbler setting edit –name=next_server –value=本机IP

cobbler管理rsync,dhcp,dns
cobbler setting edit –name=manage_rsync –value=1
cobbler setting edit –name=manage_dhcp –value=1
cobbler setting edit –name=manage_dns –value=1

设置root默认密码
这个设置只针对centos有效。我默认的root密码是:root123
openssl passwd -1 -salt ‘random-phrase-here’ ‘root123′
$1$random-p$99lAzJZEl9uunSaThe9oM0

修改配置
这个地方不能用命令修改,应该是bug
#default_password_crypted: $1$mF86/UHC$WvcIcX2t6crBz2onWxyac.
default_password_crypted: $1$random-p$99lAzJZEl9uunSaThe9oM0

排错:
[root@bogon kickstarts]# cobbler check
The following are potential configuration items that you may want to fix:

1 : file /etc/xinetd.d/rsync does not exist (有这个文件,这个报错去不掉,但是不影响使用)
Restart cobblerd and then run ‘cobbler sync’ to apply changes.

3.7 导入镜像
# mount /dev/cdrom /mnt/ # 挂载CentOS 6.5的系统镜像。
# cobbler import –path=/mnt/ –name=CentOS-6.5-x86_64 –arch=x86_64 # 导入系统镜像

# cobbler distro list # 查看镜像列表
CentOS-6.5-x86_64

3.8 指定ks.cfg文件及调整内核参数:

# 上传准备好的ks文件CentOS-6.5-x86_64.cfg到/var/lib/cobbler/kickstarts/
# 编辑profile,修改关联的ks文件
# cobbler profile edit –name=CentOS-6.5-x86_64 –kickstart=/var/lib/cobbler/kickstarts/CentOS-6.5-x86_64.cfg

3.9 同步数据,不报错就可以了
cobbler sync

ks文件内容:
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth –useshadow –enablemd5
bootloader –location=mbr
clearpart –all –initlabel
text
firewall –enabled
firstboot –disable
keyboard us
lang en_US.UTF-8
url –url=$tree
reboot
rootpw –iscrypted $default_password_crypted
selinux –disabled
skipx
timezone Asia/Shanghai
install
zerombr
clearpart –all –initlabel
part swap –size=1024
part / –fstype=ext4 –grow –size=200

%packages
@base
@core
@compat-libraries
@debugging
@development
tree
nmap
sysstat
lrzsz
dos2unix
telnet
iptraf
ncurses-devel
openssl-devel
zlib-devel
OpenIPMI-tools
screen
%end

%post
mkdir /opt
%end

 

Last modification:November 7th, 2019 at 03:28 am
如果觉得我的文章对你有用,请随意赞赏