10sr / machine-setups

My Instances setups
https://3ends.info
The Unlicense
0 stars 0 forks source link

systemd-nspawn #38

Open 10sr opened 7 years ago

10sr commented 7 years ago

作成

# mkdir /nspawn
# mkdir /nspawn/centos0
# cd /nspawn
# yum -y --releasever=7 --installroot=/nspawn/centos0 groupinstall "Base"

https://masablog.pansymade.net/2017/02/09/systemd-nspawn-%E3%81%A7-centos-%E3%81%A8-debian-%E3%82%B3%E3%83%B3%E3%83%86%E3%83%8A%E3%82%92%E4%BD%9C%E3%82%8B/

10sr commented 7 years ago

パスワード設定

# restorecon -Rv centos0
# systemd-nspawn -D centos0
# passwd
# logout

https://unix.stackexchange.com/questions/308687/systemd-nspawn-os-container-is-unusable-because-i-cant-set-the-root-password https://wiki.archlinux.org/index.php/Systemd-nspawn

10sr commented 7 years ago

SELinux

# setenforce Permissive

/etc/sysconfig/selinux を設定

http://park1.wakwak.com/%7Eima/centos4_selinux0001.html

10sr commented 7 years ago

ホストネットワーク

# yum install systemd-networkd systemd-resolved
# systemctl disable NetworkManager
# systemctl enable systemd-networkd systemd-resolved
10sr commented 7 years ago

machinectl 管理に移動

# mv /nspawn/centos0 /var/lib/machines
# systemctl enable machines.target
# systemctl enable systemd-nspawn@centos0.service