4.3. 创建 Kickstart 文件¶
如果计划执行 Acronis Cyber Infrastructure 的无人参与安装,可以使用 kickstart 文件。它将自动提供给您通常会手动选择的 Acronis Cyber Infrastructure 安装程序选项。Acronis Cyber Infrastructure 使用与 Red Hat Enterprise Linux 相同的 kickstart 文件语法。
以下部分描述了需要包含在 kickstart 文件中的选项和脚本、提供了您可以从中开始的示例,以及解释了如何使用所创建的 kickstart 文件。
4.3.1. Kickstart 选项¶
即使 kickstart 文件可能包含任何标准选项,仍建议仅使用在此部分中列出的文件。它们是强制的,必须包含在 kickstart 文件中。
auth --enableshadow --passalgo=sha512
为 Acronis Cyber Infrastructure 物理服务器指定身份验证选项。
autopart --type=lvm
对系统磁盘
sda
进行自动分区。此选项必须遵循clearpart --all
。其他磁盘将在簇创建期间自动分区。
bootloader
指定应如何安装启动加载程序。
clearpart --all
从所有识别的磁盘删除所有分区。
警告
此选项将销毁安装程序可到达的所有磁盘上的数据!
keyboard <layout>
设置系统键盘类型。
lang <lang>
设置要在安装期间使用的语言以及要在安装的系统上使用的默认语言。
logvol
为逻辑卷管理 (LVM) 组创建逻辑卷。
network <options>
配置网络设备并创建绑定和 VLAN。
raid
创建软件 RAID 卷。
part
在服务器上创建分区。
注解
/boot
分区的大小必须至少为 1 GB。rootpw --iscrypted <passwd>
为服务器设置根密码。该值是您密码的哈希,它通过在
--passalgo
参数中指定的算法获取。例如,要创建密码的 SHA-512 哈希,请运行python -c 'import crypt; print(crypt.crypt("yourpassword"))'
。selinux --disabled
禁用 SElinux,因为它阻止虚拟化正常运行。
services --enabled="chronyd"
通过 NTP 启用时间同步。
timezone <timezone>
设置系统时区。对于时区列表,请运行
timedatectl list-timezones
。volgroup
创建逻辑卷管理 (LVM) 组。
zerombr
使用无效的分区表初始化磁盘。
警告
此选项将销毁安装程序可到达的所有磁盘上的数据!
4.3.2. Kickstart 脚本¶
设置选项后,将脚本添加到将安装强制程序包组和存储组件的 kickstart 文件。
4.3.2.2. 安装管理面板和存储¶
仅需要一个管理面板,仅将其安装在第一个节点上。要部署所有其他节点,需要从运行的管理面板获取一个标记。有关更多信息,请参阅 部署次要节点。
要在节点上安装管理面板和存储组件而不在 kickstart 文件中暴露超级管理员密码和存储标记,请执行以下操作:
将
%addon com_vstorage
脚本添加到 kickstart 文件:%addon com_vstorage --management --bare %end
安装完成后,在节点上执行以下命令以配置管理面板组件:
echo <superadmin_password> | /usr/libexec/vstorage-ui-backend/bin/configure-backend.sh \ -i <private_iface> -x <public_iface>
其中:
<superadmin_password>
是管理面板的超级管理员帐户的密码。<private_iface>
是专用网络接口的名称(在计划安装期间选择用于管理网络的接口)。<public_iface>
是公共网络接口的名称(在计划安装期间选择用于管理面板网络的接口)。
启动管理面板服务:
# systemctl start vstorage-ui-backend
如果还在节点上安装了存储组件,则执行以下命令:
# /usr/libexec/vstorage-ui-agent/bin/register-storage-node.sh -m <management_IP_address>
要安装组件而其后不运行脚本(会有暴露密码和标记的风险),则在 kickstart 文件中指定公共(外部)和专用(内部)网络以及管理面板的超级管理员的密码。例如:
%addon com_vstorage --management --internal-iface=<private_iface> \
--external-iface=<public_iface> --password=<password>
%end
4.3.2.3. 仅安装存储组件¶
默认情况下将只安装存储组件(无管理面板),并且在 kickstart 文件中不要求任何脚本,除非想要指定标记。
如果不想在 kickstart 文件中暴露标记,则在安装后在节点上运行以下命令以在管理面板中注册节点:
# /usr/libexec/vstorage-ui-agent/bin/register-storage-node.sh -m <MN_IP_address> -t <token>
其中:
<token>
是可以在管理面板中获得的标记。<MN_IP_address>
是带有管理面板的节点上专用网络接口的 IP 地址。
要安装存储组件而其后不运行脚本(会有暴露标记的风险),则在kickstart 文件中指定带有管理面板的节点的标记和 IP 地址。例如:
%addon com_vstorage --storage --token=<token> --mgmt-node-addr=<MN_IP_address>
%end
4.3.3. Kickstart 文件示例¶
下面是在无人参与模式下,可以用于安装和配置 Acronis Cyber Infrastructure 的 kickstart 文件示例。可以使用此文件作为创建自己的 kickstart 文件的基础。
重要
此 kickstart 文件指示安装程序擦除它识别的每个磁盘并自动分区。确保在安装前断开与具有有用数据磁盘的连接。
# Use the SHA-512 encryption for user passwords and enable shadow passwords.
auth --enableshadow --passalgo=sha512
# Use the US English keyboard.
keyboard --vckeymap=us --xlayouts='us'
# Use English as the installer language and the default system language.
lang en_US.UTF-8
# Specify the encrypted root password for the node.
rootpw --iscrypted xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Disable SELinux.
selinux --disabled
# Enable time synchronization via NTP.
services --enabled="chronyd"
# Set the system time zone.
timezone America/New_York
# Specify a hostname for the node.
# NOTE: The only way to change the host name later is via the technical support.
network --hostname=<hostname>
# Configure network interfaces via DHCP.
network --device=<iface1> --activate
network --device=<iface2> --activate
# Alternatively, assign static addresses to network interfaces.
#network --device=<iface1> --activate --bootproto=static --ip=<IP_addr> \
#--netmask=<mask> --gateway=<gw> --nameserver=<ns1>[,<ns2>,...]
#network --device=<iface2> --activate --bootproto=static --ip=<IP_addr> \
#--netmask=<mask> --gateway=<gw> --nameserver=<ns1>[,<ns2>,...]
# If needed, uncomment and specify network interfaces to create a bond.
#network --device=bond0 --bondslaves=<iface1>,<iface2> \
#--bondopts=mode=balance-xor,miimon=100,xmit_hash_policy=layer3+4
# Erase all partitions from all recognized disks.
# WARNING: Destroys data on all disks that the installer can reach!
clearpart --all --initlabel
zerombr
# Automatically partition the system disk, which is 'sda'.
autopart --type=lvm
# Install the required packages on the node.
%packages
@^hci
%end
# Uncomment to install the admin panel and storage components.
# Specify an internal interface for the management network and
# an external interface for the admin panel network.
#%addon com_vstorage --management --internal-iface=eth0 \
#--external-iface=eth1 --password=xxxxxxxxx
#%end
# Uncomment to install the storage component. To register the node,
# specify the token as well as the IP address of the admin panel.
#%addon com_vstorage --storage --token=xxxxxxxxx --mgmt-node-addr=10.37.130.1
#%end
4.3.3.1. 在软件 RAID1 上创建系统分区¶
要在软件 RAID1 卷上创建系统分区,需要执行以下操作而不是使用 autopart
:
对磁盘分区。
创建 RAID1 卷。
创建交换和根 LVM 卷。
建议从与等于最小磁盘大小的卷相同大小的磁盘创建 RAID1。
以下示例针对基于 BIOS 的服务器对磁盘 sda
和 sdb
进行了分区、组装软件 RAID1 阵列,并创建可扩展的交换和根 LVM 卷:
# Create partitions on sda.
part biosboot --size=1 --ondisk=sda --fstype=biosboot
part raid.sda1 --size=1024 --ondisk=sda --fstype=ext4
part raid.sda2 --size=101376 --ondisk=sda --grow
# Create partitions on sdb.
part biosboot --size=1 --ondisk=sdb --fstype=biosboot
part raid.sdb1 --size=1024 --ondisk=sdb --fstype=ext4
part raid.sdb2 --size=101376 --ondisk=sdb --grow
# Create software RAID1 from sda and sdb.
raid /boot --level=RAID1 --device=md0 --fstype=ext4 raid.sda1 raid.sdb1
raid pv.01 --level=RAID1 --device=md1 --fstype=ext4 raid.sda2 raid.sdb2
# Make LVM volumes for swap and root partitions.
volgroup vgsys pv.01
logvol swap --fstype=swap --name=swap --vgname=vgsys --recommended
logvol / --fstype=ext4 --name=root --vgname=vgsys --size=10240 --grow
# Set the RAID device md0 as the first drive in the BIOS boot order.
bootloader --location=mbr --boot-drive=sda --driveorder=md0
bootloader --location=mbr --boot-drive=sdb --driveorder=md0
对于在基于 EFI 的服务器上的安装,请指定 /boot/efi
分区而不是 biosboot
。
part /boot/efi --size=200 --ondisk={sda|sdb} --fstype=efi