cobbler定制安装

详情请看上一篇

//导入redhat8镜像

[root@localhost ~]# mount /dev/cdrom /mnt
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# cobbler import --path=/mnt --name=rhel-8 --arch=x86_64
task started: 2020-07-29_191136_import
task started (id=Media import, time=Wed Jul 29 19:11:36 2020)

Found a candidate signature: breed=redhat, version=rhel8
Found a matching signature: breed=redhat, version=rhel8
Adding distros from path /var/www/cobbler/ks_mirror/rhel-8-x86_64:
creating new distro: rhel-8-x86_64
trying symlink: /var/www/cobbler/ks_mirror/rhel-8-x86_64 -> /var/www/cobbler/links/rhel-8-x86_64
creating new profile: rhel-8-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/rhel-8-x86_64 for rhel-8-x86_64
processing repo at : /var/www/cobbler/ks_mirror/rhel-8-x86_64/AppStream
need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-8-x86_64/AppStream
looking for /var/www/cobbler/ks_mirror/rhel-8-x86_64/AppStream/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel-8-x86_64/AppStream/repodata
processing repo at : /var/www/cobbler/ks_mirror/rhel-8-x86_64/BaseOS
need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-8-x86_64/BaseOS
looking for /var/www/cobbler/ks_mirror/rhel-8-x86_64/BaseOS/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel-8-x86_64/BaseOS/repodata
*** TASK COMPLETE ***


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

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

systems:
   vm1

repos:

images:

mgmtclasses:

packages:

files:


//创建kickstarts自动安装脚本
[root@localhost ~]# cat /var/lib/cobbler/kickstarts/rhel-8-x86_64.ks
#version=RHEL8
ignoredisk --only-use=nvme0n1
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
# Use graphical install
graphical
# Use CDROM installation media
cdrom
# Keyboard layouts
keyboard --vckeymap=cn --xlayouts='cn'
# System language
lang zh_CN.UTF-8

# Network information
network  --bootproto=dhcp --device=ens160 --ipv6=auto --activate
network  --hostname=localhost.localdomain
url --url=http://192.168.20.99/cobbler/ks_mirror/rhel-8-x86_64

# Root password

rootpw --iscrypted $6\$FlnlCjygygnZgk9m\$NrSrRGx7/VPjgZuYyZBg6DYhkvD6xIQhbdHznGbfXRcwjHhaQpNEMCQW52BiSXXvCcSKr6r8dWJnljDQ6jG09/
# 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


//检查ks文件语法是否有误
[root@localhost ~]# cobbler validateks
task started: 2020-07-29_202402_validateks
task started (id=Kickstart Validation, time=Wed Jul 29 20:24:02 2020)
----------------------------
osversion: rhel7
checking url: http://192.168.20.99/cblr/svc/op/ks/profile/rhel-7-x86_64
running: /usr/bin/ksvalidator -v "rhel7" "http://192.168.20.99/cblr/svc/op/ks/profile/rhel-7-x86_64"
received on stdout: 
received on stderr: 
Potential templating errors:
Unknown variable found at line 16, column 39: '$atY8eUtZX3RoH6sNo0MWYEKVts0qq3jCUXw'
----------------------------
osversion: rhel8
checking url: http://192.168.20.99/cblr/svc/op/ks/profile/rhel-8-x86_64
running: /usr/bin/ksvalidator -v "rhel8" "http://192.168.20.99/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@localhost ~]# cobbler profile list
   rhel-7-x86_64
   rhel-8-x86_64


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


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


//同步cobbler
[root@localhost ~]# cobbler sync
task started: 2020-07-29_202821_sync
task started (id=Sync, time=Wed Jul 29 20:28:21 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: find /var/lib/tftpboot/images/.link_cache -maxdepth 1 -type f -links 1 -exec rm -f '{}' ';'
received on stdout: 
received on stderr: 
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 ***


//为避免发生未知问题,先把服务端所有服务重启
[root@localhost ~]# systemctl restart httpd cobblerd xinetd


在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
也可以修改安装的配置文件安装

[root@localhost ~]# find / -name *vm* | grep cobbler
/var/lib/cobbler/config/systems.d/vm2.json 

//修改IP和mac地址和选择配置文件
cat /var/lib/cobbler/config/systems.d/vm2.json 
{"comment": "", "status": "production", "kickstart": "/var/lib/cobbler/kickstarts/rhel-8-x86_64.ks", "name_servers_search": [], "ks_meta": {}, "kernel_options_post": {}, "image": "", "redhat_management_key": "<<inherit>>", "virt_path": "<<inherit>>", "power_user": "", "kernel_options": {"biosdevname": "0", "net.ifnames": "0"}, "ctime": 1596088455.541079, "name_servers": ["114.114.114.114"], "mtime": 1596088554.386794, "enable_gpxe": false, "template_files": {}, "gateway": "192.168.20.2", "uid": "MTU5NjA4ODQ1NS41NDI0NDE1NjYuMjI0MTU", "virt_auto_boot": 0, "power_type": "ipmitool", "virt_cpus": "<<inherit>>", "mgmt_parameters": "<<inherit>>", "boot_files": {}, "hostname": "vm2", "repos_enabled": false, "mgmt_classes": [], "power_pass": "", "netboot_enabled": true, "ipv6_autoconfiguration": false, "profile": "rhel-8-x86_64", "virt_type": "xenpv", "interfaces": {"eth0": {"ipv6_address": "", "interface_type": "", "static": true, "cnames": [], "bridge_opts": "", "management": false, "interface_master": "", "mac_address": "00:50:56:3F:21:C6", "ipv6_prefix": "", "virt_bridge": "xenbr0", "netmask": "255.255.255.0", "bonding_opts": "", "ip_address": "192.168.20.138", "dhcp_tag": "", "ipv6_mtu": "", "static_routes": [], "ipv6_static_routes": [], "if_gateway": "", "dns_name": "", "mtu": "", "connected_mode": false, "ipv6_secondaries": [], "ipv6_default_gateway": ""}}, "power_address": "", "proxy": "<<inherit>>", "fetchable_files": {}, "virt_file_size": "<<inherit>>", "ldap_enabled": false, "monit_enabled": false, "ipv6_default_device": "", "virt_pxe_boot": 0, "virt_disk_driver": "<<inherit>>", "owners": "<<inherit>>", "name": "vm2", "virt_ram": "<<inherit>>", "power_id": "", "server": "<<inherit>>", "redhat_management_server": "<<inherit>>", "depth": 2, "ldap_type": "authconfig", "template_remote_kickstarts": 0}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Cobbler是一种用于集中管理和自动化Linux安装的工具。下面是关于Cobbler 3.2.1安装的步骤: 1. 首先,确保系统上已经安装了必要的依赖项。例如,Python、dhcp、tftp和Apache等。您可以使用包管理工具安装这些依赖项。 2. 下载最新版本的Cobbler 3.2.1安装包。您可以从Cobbler的官方网站或者软件存储库中获取。解压缩安装包文件。 3. 打开终端并切换到解压缩后的Cobbler目录。运行以下命令以开始安装: ``` sudo python setup.py install ``` 4. 安装过程可能会提示您输入管理员密码。根据提示完成输入密码的操作。 5. 安装完成后,运行以下命令以配置Cobbler: ``` sudo cobbler check ``` 检查命令将会列出所有需要解决的问题。根据检查结果的提示进行修复。这些问题可能涉及到配置文件、权限和依赖项。 6. 运行以下命令以启动Cobbler服务: ``` sudo systemctl start cobbler ``` 运行命令前,请确保已停止任何已经运行的Cobbler服务。 7. 运行以下命令以启动cobblerd服务: ``` sudo systemctl start cobblerd ``` 8. 最后,运行以下命令以重启Cobbler服务并使其在启动时自动启动: ``` sudo systemctl enable cobbler sudo systemctl enable cobblerd ``` 至此,您已经成功地完成了Cobbler 3.2.1的安装。您可以使用Cobbler命令行工具和Web界面来管理和配置自动化Linux安装。记得在使用Cobbler之前,确保您已经配置了正确的网络和存储设置。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值