NEW_MACHINE='centos8'
yum --releasever=8 \
--nogpg \
--installroot=/var/lib/machines/${NEW_MACHINE} \
--disablerepo='*' \
--enablerepo=BaseOS \
install systemd passwd yum sudo
sudo systemd-nspawn -D /var/lib/machines/${NEW_MACHINE}
passwd
useradd -m -r user
passwd user
usermod -G wheel user
exit
# 起動確認
sudo systemd-nspawn -bD /var/lib/machines/${NEW_MACHINE}
Ctrl+]
Ctrl+]
Ctrl+]
# unit file
systemctl enable systemd-nspawn@${NEW_MACHINE}.service
(echo '[Service]'
echo 'ExecStart='
echo 'ExecStart=/usr/bin/systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --machine=%I'
) | SYSTEMD_EDITOR=tee systemctl edit systemd-nspawn@${NEW_MACHINE}.service
cat /usr/lib/systemd/system/systemd-nspawn@.service
cat /etc/systemd/system/machines.target.wants/systemd-nspawn@${NEW_MACHINE}.service
cat /etc/systemd/system/systemd-nspawn@${NEW_MACHINE}.service.d/override.conf
machinectl start ${NEW_MACHINE}
machinectl login ${NEW_MACHINE}
More than 3 years have passed since last update.
CentOS8 に systemd-nspawn用 CentOS8 コンテナを作成する
Last updated at Posted at 2020-07-16
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme