CentOS 8 安装步骤(Kickstart 版)
筹备
-
- 准备一个Web服务器,并设置以下文件。
确保可以通过http:///ks/centos8-x86_64-ks.cfg访问。
参考附录B. Kickstart命令和选项参考Red Hat Enterprise Linux 8 | Red Hat Customer Portal替换root和普通用户的密码。
$ python -c ‘import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass(“确认密码: “)) else exit())’
同时,将主机名、用户名、PID、GID和软件包等设置为合适的字符串。
#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
步驟 (bù
-
- 根据 “CentOS 8 インストール手順 – Qiita” 这篇文章的指南,创建并启动一个虚拟机。
-
- 选择 “CentOS Linux 8.0.1905: Install CentOS Linux 8.0.1905″,按下Tab键,在后面添加 “ip=enp0s3:dhcp inst.ks=http:///ks/centos8-x86_64-ks.cfg”,然后按下Enter键。
- 安装完成后,虚拟机会自动关闭,然后从光驱中移除介质。
突然来了。