cobbler定制安装

cobbler定制安装

需求:部署自动安装centos7和centos8系统在两台主机上开机选择安装界面

实验环境主机IP
centos7192.168.88.128

首先准备配置centos8,详细步骤可以参考cobbler配置

//导入centos8镜像
//镜像需要自己提前准备并放到虚拟机的虚拟CD/DVD里面
[root@localhost ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 is write-protected, mounting read-only
[root@localhost ~]# cobbler import --path=/mnt --name=centos8 --arch=x86_64
task started: 2020-07-29_060428_import
task started (id=Media import, time=Wed Jul 29 06:04:28 2020)
Found a candidate signature: breed=redhat, version=rhel8
Found a matching signature: breed=redhat, version=rhel8
......
......
processing repo at : /var/www/cobbler/ks_mirror/centos8-x86_64/Minimal
need to process repo/comps: /var/www/cobbler/ks_mirror/centos8-x86_64/Minimal
looking for /var/www/cobbler/ks_mirror/centos8-x86_64/Minimal/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos8-x86_64/Minimal/repodata
*** TASK COMPLETE ***

//查看cobbler镜像列表
[root@localhost ~]# cobbler list
distros:
   centos7-x86_64
   centos8-x86_64

profiles:
   centos7-x86_64
   centos8-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

//创建centos8的kickstarts自动安装脚本
[root@localhost ~]# cat > /var/lib/cobbler/kickstarts/centos5-x86_64.ks <<EOF
#version=RHEL8
ignoredisk --only-use=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
# Use graphical install
text
reboot
# Use CDROM installation media
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

# Network information
url --url=http://192.168.88.128/cobbler/ks_mirror/centos8-x86_64
# Root password
rootpw --iscrypted $1$9839\$WLJRabcfEsrXFrLJ4Sau80
# Run the Setup Agent on first boot
firstboot --enable
# Do not configure the X Window System
skipx
# System services
services --enabled="chronyd"
# System timezone
timezone America/New_York --isUtc

%packages
@^minimal-environment
kexec-tools

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
EOF

//查看当前cobbler有哪些配置文件
[root@localhost ~]# cobbler profile list
   centos7-x86_64
   centos8-x86_64
   
//配置网卡名称为传统网卡名称eth0
[root@localhost ~]# cobbler profile edit --name centos8-x86_64 --kopts='t.ifnames=0 biosdevname=0'

//检查当前系统cobbler配置文件信息
[root@localhost ~]# cobbler profile report
Name                           : centos7-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos7-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {'biosdevname': '0', 'net.ifnames': '0'}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/centos7-x86_64.ks
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm

Name                           : centos8-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos8-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {'biosdevname': '0', 'net.ifnames': '0'}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/centos8-x86_64.ks
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm

//同步cobbler
[root@localhost ~]# cobbler sync
task started: 2020-07-30_051034_sync
task started (id=Sync, time=Thu Jul 30 05:10:34 2020)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/centos7-x86_64
removing: /var/www/cobbler/images/centos8-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
......
......
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.manage_genders
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

在开始配置web界面之前还有最后一项准备工作:取出mac地址

  • 首先创建两个虚拟机(centos7,centos8),创建过程略,只需注意内存大小必须2G以上即可
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

centos8做同样设置

  • 下面开始centos7的web配置

在浏览器输入IP+cobbler_web,默认账号密码都是cobbler,然后点击Login登录
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

  • centos8的配置同上

  • 同步配置信息

//同步信息
[root@localhost ~]# cobbler sync
task started: 2020-07-30_061636_sync
task started (id=Sync, time=Thu Jul 30 06:16:36 2020)
running pre-sync triggers
cleaning trees
......
......
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.manage_genders
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

//重启服务
[root@localhost ~]# systemctl restart cobblerd.service xinetd.service httpd.service
  • 虚拟机中启动两台机器测试

    • centos7:可以看到不需要手动选择安装了
      在这里插入图片描述
      在这里插入图片描述
      centos7安装成功!

    • centos8:可以看到centos8也不需要手动选择安装了
      在这里插入图片描述
      在这里插入图片描述
      centos8安装完成!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值