在Ubuntu中,Kickstart文件用于自动化安装过程
创建Kickstart文件:首先,创建一个名为ks.cfg的文件。你可以将其放在/etc/anaconda/目录下,或者根据你的需求将其放在其他位置。
使用文本编辑器打开ks.cfg文件,并添加以下内容:
#version=DEVEL# System authorization informationauth --enableshadow --passalgo=sha512# Use network installationurl --url="http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/"# Run the Setup Agent on first bootfirstboot --enable# Keyboard layoutskeyboard --vckeymap=us --xlayouts='us'# System languagelang en_US.UTF-8# Network informationnetwork --bootproto=dhcp --device=link --ipv6=auto --activatenetwork --hostname=localhost.localdomain# Root passwordrootpw --iscrypted $6$rhel7$YOUR_ENCRYPTED_PASSWORD_HERE# System servicesservices --enabled="chronyd"# Partition clearing informationclearpart --none --initlabel# Disk partitioning informationpart /boot --fstype="ext4" --ondisk=sda --size=500part pv.01 --fstype="lvmpv" --ondisk=sda --size=1 --growvolgroup centos --pesize=4096 pv.01logvol / --fstype="xfs" --size=1 --grow --name=root --vgname=centoslogvol swap --fstype="swap" --size=2048 --name=swap --vgname=centos%packages@^minimalchronykexec-tools%end%addon com_redhat_kdump --enable --reserve-mb='auto'%end%anacondapwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notemptypwpolicy user --minlen=6 --minquality=1 --notstrict --nochangespwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges%end请根据你的需求修改上述内容。例如,你可以更改语言、键盘布局、时区、网络设置、用户密码等。
保存并关闭文件。
在启动安装程序时,使用--append选项指定Kickstart文件的路径。例如:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg --append="ks=file:/path/to/ks.cfg"确保将/path/to/ks.cfg替换为实际的Kickstart文件路径。
现在,当你使用Kickstart文件进行Ubuntu安装时,它将根据你在文件中指定的设置进行自动化配置。