Skip to content

Commit

Permalink
Merge pull request #902 from mkllnk/lxc
Browse files Browse the repository at this point in the history
Add convenience script to set up LXC
  • Loading branch information
dacook authored Oct 10, 2023
2 parents 16d6e27 + 19cb670 commit 0646623
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions bin/setup-lxc
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0646623

Please sign in to comment.