Archlinux provides a rich set of docs which are a good practical starting point. This blog entry mostly adapt the systemd container pages to Mageia
- Arch systemd container - main explanations
- systemd-networkd - various container network configurations
The main differences between Archlinux and Mageia regarding these documents are the packaging system and the network configuration. The Mageia chroot page explain how to populate a directory (lets use a btrfs one) with base system with minimum configuration.
Lets suppose you have a directory named "mageia", first add all media:
# urpmi.addmedia --distrib --urpmi-root mageia
ftp://mirror.netcologne.de/mageia/distrib/cauldron/x86_64/
Then install basesystem and other packages needed for your application:
# urpmi --urpmi-root mageia basesystem
# urpmi --urpmi-root mageia java
You have to create a regular user (i.e. other than root, which you can log with) and set the root passwd in the chroot environment (I did not succeed to log directly as root).
Log as root without booting
# cd mageia
# systemd-nspawn -D .
Change the root passwd in the chroot
# passwd
Add regular user in chroot and exit
# createuser test
# exit
You can now launch the container and log in using the regular user you just created
# systemd-nspawn -bD .
To adapt network configuration from the Archlinux page, I do have to remove the default route that was created for br0 on Magiea. This is depending on your configuration, so it is better to check if nothing strange appears in your route after having started systemd-networkd service.
You can even copy the chroot directory on a Debian installation to use your Mageia chroot on your Debian (and vice-versa).
Aucun commentaire:
Enregistrer un commentaire