準備
- Web サーバーを用意し, 以下のファイルを設置する。
-
http://<FQDN>/ks/centos8-x86_64-ks.cfg
でアクセスできるようにする。 - root や一般ユーザーのパスワードは, Appendix B. Kickstart commands and options reference Red Hat Enterprise Linux 8 | Red Hat Customer Portal を参考に置換すること。
$ python -c 'import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass("Confirm: ")) else exit())'
- 他にもホスト名やユーザー名, PID, GID, パッケージなどの設定は適切な文字列に置換すること。
-
centos8-x86_64-ks.cfg
# version=RHEL8
# Use text install
text
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us','jp'
# System language
lang ja_JP.UTF-8
# Network information
network --hostname=centos8
network --bootproto=dhcp --device=enp0s3 --ipv6=auto --activate
network --bootproto=dhcp --device=enp0s8 --ipv6=auto --activate
# System timezone
timezone Asia/Tokyo --isUtc --ntpservers=2.centos.pool.ntp.org,2.centos.pool.ntp.org,2.centos.pool.ntp.org,2.centos.pool.ntp.org
# System services
services --enabled="chronyd"
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
# Partition clearing information
clearpart --all --initlabel
ignoredisk --only-use=sda
autopart --type=lvm --nohome --noswap
# Use network installation
url --url="http://ftp.riken.jp/pub/Linux/centos/8/BaseOS/x86_64/os/"
repo --name="AppStream" --baseurl=http://ftp.riken.jp/pub/Linux/centos/8/AppStream/x86_64/os/
repo --name="extras" --baseurl=http://ftp.riken.jp/pub/Linux/centos/8/extras/x86_64/os/
repo --name="epel" --baseurl=http://ftp.riken.jp/pub/Linux/fedora/epel/8/Everything/x86_64/
# Root password
rootpw --iscrypted --lock xxxxxxxx
# Run the Setup Agent on first boot
firstboot --enable
# Do not configure the X Window System
skipx
## Poweroff after installation
poweroff
## Create user
user --name=ryo --gid=100 --groups="wheel" --uid=1001 --iscrypted --password="xxxxxxxx"
sshkey --username=ryo "<SSH 公開鍵>"
%packages
@^minimal-environment
epel-release
python3
python3-libselinux
emacs-nox
screen
%end
%addon com_redhat_kdump --disable --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
%post --log=/root/ks-post.log
sed -i -e 's/^%wheel/# %wheel/g' -e 's/^# %wheel\tALL=(ALL)\tNOPASSWD: ALL$/%wheel\tALL=(ALL)\tNOPASSWD: ALL/g' /etc/sudoers
%end
手順
- CentOS 8 インストール手順 - Qiita を参考に仮想マシンを作成し, 起動する。
- CentOS Linux 8.0.1905: Install CentOS Linux 8.0.1905 を選択し, Tab キー を押下,
ip=enp0s3:dhcp inst.ks=http://<FQDN>/ks/centos8-x86_64-ks.cfg
と追記し, Enter キー を押下する。 - インストールが完了すると仮想マシンが終了するので, 光学ドライブからメディアを除去する。
どっとはらい。