cabbler-定制安装

cabbler-定制安装

前篇cabbler基本配置
解释ks配置文件信息



1.挂载rh8光盘
[root@zyy180 ~]# mount /dev/sr0 /mnt
mount: /dev/sr0 写保护,将以只读方式挂载






2.导入redhat8镜像
[root@zyy180 ~]# cobbler import --path=/mnt --name=rhel-8 --arch=x86_64







查看cobbler镜像列表
[root@zyy180 ~]# cobbler list

distros:
   rhel-7-x86_64
   rhel-8-x86_64

profiles:
   rhel-7-x86_64
   rhel-8-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:






3.创建kickstarts自动安装脚本
cat > /var/lib/cobbler/kickstarts/rhel-8-x86_64.ks <<'EOF'
ignoredisk --only-use=nvme0n1
autopart --type=lvm

clearpart --none --initlabel

cdrom

keyboard us
lang en_US
firewall --disabled
firstboot --disable
url --url=http://192.168.30.150/cobbler/ks_mirror/rhel-8-x86_64
$yum_repo_stanza 
reboot
rootpw --iscrypted $6\$WqPNYBRedJA4UUo6\$U4m37YLINahrkMpLt3bi4g9SOJMIoCHILvz3C6yGjsbTf2khLCWOAmlao/40BKt552Q4TqPMY.WsCqTd9T8LT1

selinux --disabled
skipx
timezone Asia/Shanghai --isUtc --nontp
install
zerombr


%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







4.检查ks文件语法是否有误
[root@zyy180 ~]# cobbler validateks
task started: 2020-07-29_221035_validateks
task started (id=Kickstart Validation, time=Wed Jul 29 22:10:35 2020)
----------------------------
osversion: rhel7
checking url: http://192.168.30.150/cblr/svc/op/ks/profile/rhel-7-x86_64
running: /usr/bin/ksvalidator -v "rhel7" "http://192.168.30.150/cblr/svc/op/ks/profile/rhel-7-x86_64"
received on stdout: 
received on stderr: 
----------------------------
osversion: rhel8
checking url: http://192.168.30.150/cblr/svc/op/ks/profile/rhel-8-x86_64
running: /usr/bin/ksvalidator -v "rhel8" "http://192.168.30.150/cblr/svc/op/ks/profile/rhel-8-x86_64"
received on stdout: rhel8版本不被pykickstart支持

received on stderr: 
*** potential errors detected in kickstarts ***
!!! TASK FAILED !!!







查看当前cobbler有哪些配置文件
[root@zyy180 ~]# cobbler profile list
   rhel-7-x86_64
   rhel-8-x86_64





5.修改profile,将我们新建的ks文件设为默认的kickstarts安装文件
[root@zyy180 ~]# cobbler profile edit --name rhel-8-x86_64 --kickstart=/var/lib/cobbler/kickstarts/rhel-8-x86_64.ks






6.配置网卡名称为传统网卡名称eth0
[root@zyy180 ~]# cobbler profile edit --name rhel-8-x86_64 --kopts='net.ifnames=0 biosdevname=0'






7.检查当前系统cobbler配置文件信息
[root@zyy180 ~]# cobbler profile report
Name                           : rhel-7-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : rhel-7-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/rhel-7-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                           : rhel-8-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : rhel-8-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/rhel-8-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







8.同步cobbler
[root@zyy180 ~]# cobbler sync
task started: 2020-07-29_221236_sync
task started (id=Sync, time=Wed Jul 29 22:12:36 2020)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/rhel-7-x86_64
removing: /var/www/cobbler/images/rhel-8-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/images/rhel-7-x86_64
removing: /var/lib/tftpboot/images/rhel-8-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
copying distros to tftpboot
copying files for distro: rhel-7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/rhel-7-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/rhel-7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/rhel-7-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/rhel-7-x86_64/initrd.img
copying files for distro: rhel-8-x86_64
trying hardlink /var/www/cobbler/ks_mirror/rhel-8-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/rhel-8-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/rhel-8-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/rhel-8-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: rhel-7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/rhel-7-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/rhel-7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/rhel-7-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/rhel-7-x86_64/initrd.img
Writing template files for rhel-7-x86_64
copying files for distro: rhel-8-x86_64
trying hardlink /var/www/cobbler/ks_mirror/rhel-8-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/rhel-8-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/rhel-8-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/rhel-8-x86_64/initrd.img
Writing template files for rhel-8-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
processing boot_files for distro: rhel-7-x86_64
processing boot_files for distro: rhel-8-x86_64
cleaning link caches
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout: 
received on stderr: 
running: service dhcpd restart
received on stdout: 
received on stderr: Redirecting to /bin/systemctl restart dhcpd.service

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 ***






9.查看DHCP状态
[root@zyy180 ~]# netstat -anulp|grep dhcp
udp        0      0 0.0.0.0:67              0.0.0.0:*                           7238/dhcpd          





10重启服务
[root@zyy180 ~]# systemctl restart xinetd
[root@zyy180 ~]# systemctl restart cobblerd
[root@zyy180 ~]# systemctl restart httpd
[root@zyy180 ~]# ss -anlt
State       Recv-Q Send-Q Local Address:Port                Peer Address:Port              
LISTEN      0      128                *:22                             *:*                  
LISTEN      0      100        127.0.0.1:25                             *:*                  
LISTEN      0      5          127.0.0.1:25151                          *:*                  
LISTEN      0      5                  *:873                            *:*                  
LISTEN      0      128               :::80                            :::*                  
LISTEN      0      128               :::22                            :::*                  
LISTEN      0      100              ::1:25                            :::*                  
LISTEN      0      128               :::443                           :::*                  
LISTEN      0      5                 :::873                           :::*   



成功
在这里插入图片描述


开始定制安装

配置RH7定制安装

1.登录cobbler

https://192.168.30.150/cobbler_web/system/list
服务端的IP

用户名和密码默认cobbler
在这里插入图片描述

2.创建定制模块

在这里插入图片描述

3.选择参数

Name 系统主机名
Profile 使用2那个配置文件
Kernel Options 内核参数(将网卡回归传统命名)
Kickstart 指定装机配置文件

在这里插入图片描述


Hosname 主机名
Gateway 网关
Name Servers DNS

在这里插入图片描述


Add Interface 添加网卡(写网卡名)
MAC MAC地址
IP IP地址
Subnet Mask 子网掩码

在这里插入图片描述


成功
在这里插入图片描述



配置RH8的定制安装

在这里插入图片描述


在这里插入图片描述


在这里插入图片描述


成功

在这里插入图片描述

在这里插入图片描述

©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页