cobbler批量安装测试

简介

使用cobbler批量安装系统的流程

环境

CentOS7

  • VirtualBox5,虚拟机用两个网卡,网卡2配置IP(192.168.1.1/24)
    网络配置

cobbler安装及验证

  1. 安装
    关闭防火墙
sed -i 's/=enforcing/=disabled/g' /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
setenforce 0

安装软件,包含dhcp、tftp及tftp提供服务的xinetd、cobbler的其他配件

yum install epel-release -y
yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd tftp xinetd

安装syslinux,提供pxelinux.0

yum install syslinux -y

安装net-tools,提供netstat命令供查看各组件是否正常启动了端口

yum install net-tools -y
  1. 修改cobbler的配置
    修改next_server提供给dhcp服务,server指定资源树的地址
sed -i 's/server: 127.0.0.1/server: 192.168.1.1/g' /etc/cobbler/settings
sed -i 's/next_server: 127.0.0.1/next_server: 192.168.1.1/g' /etc/cobbler/settings

#下面是让cobbler管理dhcp及tftp,
这里使用192.168.1.1的地址,所以cobbler中dhcp的配置都不需要修改;

sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings
sed -i '/disable.*=.yes/ s/yes/no/' /etc/xinetd.d/tftp 
#sed -i 's/192.168.1/10.10.0/g' /etc/cobbler/dhcp.template
  1. 启动cobbler及配置检查
    启动cobblerd
systemctl restart cobblerd httpd rsyncd
systemctl enable cobblerd httpd rsyncd
systemctl status cobblerd httpd rsyncd

检查配置

cobbler check

检查结果如下

selinux已经关闭了,重启虚拟机,selinux这个告警就消失了
1 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:  
这个cobbler get-loaders已经在官网无法下载;这个也不是必须的;syslinux安装后,这个就有了替代了;
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 : debmirror package is not installed, it will be required to manage debian deployments and repositories
这是配置装机后的默认密码,默认密码cobbler;也可以用openssl passwd -1 -salt `openssl rand -hex 3` 123456生成密码
4 : 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
这个不是必须的
5 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

所有的配置检查完毕后,重启cobbler,在执行一次sync

systemctl restart cobblerd
cobbler sync
  1. 找一台空白的没有系统的虚拟机进行测试
    首先启动dhcp及tftp(tftp的启动包含tftp及xinetd两部分)
systemctl start dhcpd tftp xinetd
systemctl enable dhcpd tftp xinetd
systemctl status dhcpd tftp xinetd

然后新建一台虚拟机,选择从网络启动,即可以看到安装的初始化界面;
在这里插入图片描述
启动后,经过dhcp、tftp后,出现下面的界面
在这里插入图片描述

cobbler的命令及使用

  1. 导入系统
    首先挂载ISO镜像,在虚拟机选择centos7的ISO镜像,挂载ISO
mount /dev/cdrom /mnt

然后导入ISO到cobbler中

cobbler import --name=centos76 --path=/mnt
cobbler list
cobbler sync #用于同步每次新导入的ks文件或其他东东

最后安装测试
注意:待安装系统的虚拟机的配置,硬盘空间设置的大一些20G,内存也大一些2G,可以减少一些错误。
在这里插入图片描述

cobbler的其他事项

  1. cobbler的默认界面的修改
    其中在/var/lib/tftpboot/pxelinux.cfg/default中配置了menu菜单
    若不想要那个local,改成下面的文件即可。
[root@10 ~]# cat /etc/cobbler/pxe/pxedefault.template
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.io/
TIMEOUT 200
TOTALTIMEOUT 6000
#ONTIMEOUT $pxe_timeout_profile
ONTIMEOUT centos76-x86_64
$pxe_menu_items
MENU end
[root@10 ~]#
  1. cobbler的各种日志
tail -f /var/log/cobbler/cobbler.log #cobbler的日志
tail -f /var/log/httpd/error_log #http的日志
tail -f /var/log/message #tftp和dhcp的部分日志
  1. cobbler的web的登录的账号及密码,请注意,这是443端口
https://127.0.0.1/cobbler_web/
账号 cobbler 密码 cobbler

主要参考:B站视频
次要参考:https://www.cnblogs.com/yanjieli/p/11016825.html
时间:2021-06-24

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值