forked from andonome/lk
remove duff lxc
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
---
|
||||
title: "lxc"
|
||||
tags: [ "Documentation", "distros" ]
|
||||
---
|
||||
# Intro
|
||||
|
||||
Taken from [this](https://r4nd0m6uy.ch/unpriviledged-containers-in-void-linux.html)
|
||||
Void linux requires additional steps to set up, as Systemd is no present to automatically take care of everything.
|
||||
|
||||
> sudo xbps-install cgmanager dbus bridge-utils lxc
|
||||
|
||||
Next, startup services:
|
||||
|
||||
> sudo ln -s /etc/sv/dbus/ /var/service/
|
||||
|
||||
> sudo ln -s /etc/sv/cgmanager/ /var/service/
|
||||
|
||||
> sudo sv start dbus
|
||||
|
||||
> sudo sv start cgmanager
|
||||
|
||||
> sudo sv start dbus
|
||||
|
||||
> sudo sv start cgmanager
|
||||
|
||||
Maps your user account to the lxc g/u ids:
|
||||
|
||||
> sudo usermod --add-subuids 100000-165536 $USER
|
||||
|
||||
> sudo usermod --add-subgids 100000-165536 $USER
|
||||
|
||||
Then add a bridge interface to connect the container.
|
||||
|
||||
> sudo brctl addbr lxbr0
|
||||
|
||||
Then add an interface. I have no idea how this is done or what it means, so I tried my wifi 'wlp3s0', and that was refused. I tried the guide's one, which obviously didn't work as I didn't have the same interface as in the guide. Finally, I tried `ip addr show` and noticed other devices 'lo' and 'wwp0s20u4i6'. This gave me:
|
||||
|
||||
> sudo brctl addif lxbr0 wwp0s20u4i6
|
||||
|
||||
... which worked.
|
||||
|
||||
If you don't want to redo this each boot, you can make a runit service for it apparently - more research is required for this. For now, I'm just copy-pasting the guide (almost) and sticking this in ~/.config/lxc/default.conf:
|
||||
|
||||
`lxc.network.type = veth`
|
||||
|
||||
`lxc.network.link = wwp0s20u4i6`
|
||||
|
||||
`lxc.network.flags = up`
|
||||
|
||||
`lxc.network.hwaddr = 00:16:3e:BB:CC:DD`
|
||||
|
||||
`lxc.id_map = u 0 100000 65536`
|
||||
|
||||
`lxc.id_map = g 0 100000 65536`
|
||||
|
||||
You can now configure a different bridge each boot to connect with the lxc containers, or ....
|
||||
|
||||
Next, do this at *every boot* (or script it):
|
||||
|
||||
> sudo cgm create all $USER
|
||||
|
||||
> sudo cgm chown all $USER $(id -u) $(id -g)
|
||||
|
||||
> cgm movepid all $USER $$
|
||||
|
||||
|
@@ -1,72 +0,0 @@
|
||||
---
|
||||
title: "lxc"
|
||||
tags: [ "Documentation", "Distros" ]
|
||||
---
|
||||
|
||||
LXC creates miniature virtual machines to play with.
|
||||
|
||||
# Configuration
|
||||
|
||||
## Templates
|
||||
|
||||
On Void you can install this with:
|
||||
|
||||
> # xbps-install -S jq skopeo umoci
|
||||
|
||||
After you've installed a whopping 46 Megabytes, you can configure it in /etc/lxc/default.conf if you want to change global configs, otherwhise, it's the usual ~/.config/lxc/dfault.conf.
|
||||
|
||||
## Networking
|
||||
|
||||
Make a virtual network:
|
||||
|
||||
> # ip link add dev BRIDGE type bridge
|
||||
> # ip link set dev BRIDGE up
|
||||
> # ip link set dev NIC master BRIDGE
|
||||
|
||||
Things in caps can be renamed.
|
||||
|
||||
#Create a machine
|
||||
|
||||
> lxc-create -n roach-1
|
||||
|
||||
This makes a machine with the name 'roach-1'. We can also apply a preconfigured theme with '-t', such as 'ubuntu'.
|
||||
|
||||
> lxc-create -n roach-2 -t ubuntu
|
||||
|
||||
Additionally, there we can examine, destroy and freeze containers.
|
||||
|
||||
> lxc-ls -n roach-1
|
||||
|
||||
> lxc-destroy -n roach-1
|
||||
* Add '-k' to kill a process without mercy.
|
||||
|
||||
> lxc-freeze -n roach-2
|
||||
|
||||
> lxc-unfreeze -n roach-1
|
||||
|
||||
#Example
|
||||
|
||||
> for r in $(lxc-ls -1); do
|
||||
|
||||
> lxc-info -n $r
|
||||
|
||||
> done
|
||||
|
||||
# Monitor
|
||||
|
||||
You can monitor a set of containeers.
|
||||
|
||||
> lxc-monitor -n "roach-1|roach-2"
|
||||
|
||||
Or monitor all containers.
|
||||
|
||||
> lxc-monitor -n ".*"
|
||||
|
||||
# LXD
|
||||
|
||||
Setup by starting the lxd service, and adding your user to the group "lxd", then:
|
||||
|
||||
> sudo lxd init
|
||||
|
||||
Default port is 8443.
|
||||
|
Reference in New Issue
Block a user