From 19cb6706a6de62a14100eaea55129d55bac7d6ba Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 9 Oct 2023 16:58:04 +1100 Subject: [PATCH] Add convenience script to set up LXC --- bin/setup-lxc | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 bin/setup-lxc diff --git a/bin/setup-lxc b/bin/setup-lxc new file mode 100755 index 000000000..d30e294a4 --- /dev/null +++ b/bin/setup-lxc @@ -0,0 +1,38 @@ +#!/bin/sh + +# Set up Linux Containers (LXC) +# +# If you don't run Linux, you better look at Vagrant to set up virtual machines. +# +# But if you run Linux anyway then you can use LXC to run virtual machines on +# the same kernel instead of creating a full virtual machine. +# +# Installation in Debian: +# +# sudo apt install lxd +# sudo lxd init +# sudo usermod -aG lxd "$USER" +# # Restart your user's session to gain the new group privilege. +# +# You may also like to look at Lexi to manage your LXC containers: +# +# https://github.com/libre-ops/lexi + +lxc launch ubuntu:20.04 ofn-dev +lxc exec ofn-dev -- sh -c 'cat >> .ssh/authorized_keys' < ~/.ssh/id_rsa.pub + +# Enable browsing the OFN app via https://localhost:4433 +lxc config device add ofn-dev myport4433 proxy listen=tcp:0.0.0.0:4433 connect=tcp:127.0.0.1:443 + +ip_address="$(lxc list | grep ofn-dev | cut -d' ' -f6)" +echo " +Host ofn.local + Hostname $ip_address + User root + UserKnownHostsFile /dev/null + StrictHostKeyChecking no + PasswordAuthentication no + LogLevel FATAL +" >> "$HOME/.ssh/config" + +ansible-playbook -l lxc site.yml