Difference between revisions of "Systemd-nspawn"

From ArchWiki
Jump to: navigation, search
(Fix style. Add category. See Help:Style.)
Line 1: Line 1:
 +
[[Category:Security]]
 
Quick guide on how to create a lightweight systemd container for Arch Linux, using systemd-nspawn and pacstrap, in under 1 minute!
 
Quick guide on how to create a lightweight systemd container for Arch Linux, using systemd-nspawn and pacstrap, in under 1 minute!
  
 
== Installation ==
 
== Installation ==
  
<pre>
+
pacman -S arch-install-scripts
pacman -S arch-install-scripts
+
mkdir /srv/subarch
mkdir /srv/subarch
+
pacstrap -c -d /srv/subarch base
pacstrap -c -d /srv/subarch base
+
systemd-nspawn -bD /srv/subarch
systemd-nspawn -bD /srv/subarch
+
</pre>
+
  
 
And that's it! Log in as "root" with no password.
 
And that's it! Log in as "root" with no password.
Line 14: Line 13:
 
You can remove the kernel to save space within the container. DO NOT RUN THIS ON THE HOST!
 
You can remove the kernel to save space within the container. DO NOT RUN THIS ON THE HOST!
  
<pre>
+
pacman -Rsn linux
pacman -Rsn linux
+
</pre>
+
  
Once you're done with the container just shut it down with <tt>poweroff</tt>
+
Once you're done with the container just shut it down with {{ic|poweroff}}.

Revision as of 00:58, 8 February 2013

Quick guide on how to create a lightweight systemd container for Arch Linux, using systemd-nspawn and pacstrap, in under 1 minute!

Installation

pacman -S arch-install-scripts
mkdir /srv/subarch
pacstrap -c -d /srv/subarch base
systemd-nspawn -bD /srv/subarch

And that's it! Log in as "root" with no password.

You can remove the kernel to save space within the container. DO NOT RUN THIS ON THE HOST!

pacman -Rsn linux

Once you're done with the container just shut it down with poweroff.