Skip to content

Instantly share code, notes, and snippets.

@mvdbeek
Created November 25, 2015 19:02
Show Gist options
  • Save mvdbeek/6741bee82bd5d37aeda5 to your computer and use it in GitHub Desktop.
Save mvdbeek/6741bee82bd5d37aeda5 to your computer and use it in GitHub Desktop.
Installing maas in trusty 14.04

What works:

Ubuntu-14.04 LTS container in LXC container:

Activate trusty-backports in /etc/apt/sources.list.d/trusty-backports

deb http://fr.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://fr.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse

apt-get install -y lxc lxcfs

Download container image and create a privileged trusty container

Edit the lxc settings (in /etc/lxc/default or in /var/lib/lxc/$NAME_OF_THE_CONTAINER/) to look like this for the network config:

lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.network.flags = up
lxc.network.hwaddr = 00:16:3e:xx:xx:xx
lxc.network.name = eth0
lxc.network.ipv4 = 10.0.3.111
lxc.network.ipv4.gateway = 10.0.3.1

lxc.network.type = phys
lxc.network.link = eth1
lxc.network.flags = up
lxc.network.hwaddr = 78:2b:cb:5f:3c:92
lxc.network.ipv4 = 192.168.1.1/24
lxc.cgroup.devices.allow = c 10:137 rwm # loop-control
lxc.cgroup.devices.allow = b 7:* rwm    # loop*

This is binding eth1 as a physical device into the container.

sudo lxc-create -t download -n maas -- --dist ubuntu --release trusty --arch amd64

it will hiccup becasue the gpg keyserver can't be reached ... I edited /usr/share/lxc/templates/lxc-download and added :80 at the end of the hkp lines Supposedly you could also set a http_proxy ... didn't work for me.

start and enter the container with:

sudo lxc-start -n maas -d
sudo lxc-attach -n maas

Inside the container we have to delete the /etc/resolv.conf and replace it with

nameserver 10.0.3.1

then install maas from the maas/next ppa.

To get wakeonlan working install etherwake (not wakeonlan! can't specify the the ethernet device ...) and edit the template in /etc/maas/templates/power/ether_wake.template

sed -i "s|/usr/sbin/etherwake $mac_address|sudo /usr/sbin/etherwake -i eth1 $mac_address|g"

then allow the maas user to use sudo on etherwake:

visudo -f /etc/sudoers.d/99-maas-sudoers
maas ALL= NOPASSWD: /usr/sbin/etherwake

That's it. Import bootimages and away you go. To also act as a NAT server for clients on eth1, install iptables and issue

iptables -t nat -A postrouting -o eth0 -j SNAT --to 10.0.3.111

Inside maas activate and configure dhcp and dns, and clients will be served a working NAT connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment