User Tools

Site Tools


Writing /var/lib/dokuwiki/data/meta/tutorials/systemd-nspawn.meta failed
tutorials:systemd-nspawn

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tutorials:systemd-nspawn [2016/09/30 06:49] – created dgarciatutorials:systemd-nspawn [2022/09/20 00:08] (current) – external edit 127.0.0.1
Line 1: Line 1:
-======Debian Chroot using systemd-nspawn======+======Chroot using systemd-nspawn======
  
-This tutorial is for creating a Debian chroot inside a system that has systemd fully implemented. This tutorial will not work on current Debian stable (jessie). +===== Installation =====
  
-First we need a basic Debian installation, +This tutorial is for creating a minimal Linux chroot inside a Linux distro that has SystemD fully implemented. This tutorial will not work on Debian Jessie.  
 + 
 +First we need to install some dependencies: 
 + 
 +  sudo apt-get install debootstrap systemd-container 
 +   
 +Depending on you distro, you may use another package manager to install instead. Now that we have debootstrap, we can have a basic Linux distro installation. In the example below we create a minimal Debian Jessie installation on ///var/chroot// directory  
 + 
 +  sudo mkdir -p /var/chroot 
 +  sudo debootstrap --arch amd64 jessie /var/chroot http://ftp.us.debian.org/debian/ 
 +   
 +After this, the chroot is installed and fully functional. 
 + 
 +===== Using for the first time ===== 
 + 
 +In order to access the chroot for the first time, use: 
 + 
 +  sudo systemd-nspawn -D /var/chroot 
 +   
 +This will let you to use the chroot as root user. It is a bad idea to use root, so first setup a root password, and then create a user. Once this is done, your chroot is ready for everyday usage. 
 + 
 +===== Usage ===== 
 + 
 +To boot a chroot inside a [[https://en.wikipedia.org/wiki/LXC|container]] use: 
 + 
 +  sudo systemd-nspawn -D /var/chroot -b 
 +   
 +This will give you a login screen, so log in as your user.  
 + 
 +To log more terminals to this containeruse: 
 + 
 +  sudo machinectl login chroot
tutorials/systemd-nspawn.1475218146.txt.gz · Last modified: 2022/09/20 00:08 (external edit)