In part 1 we talked about the “Why” behind this project. In this, we start talking about the “How”. In this post, the “How” that we will cover, will get us from “Ok I have a rPI” to where we’re ready to install OpenStack.
- What we’re building
- Getting an OS onto the rPI
- Connecting to the rPI
- Building an LXC compatible Kernel
- Launching an LXC container
Note: Rather than cover all of these steps explicitly (as there are a lot of them) I will link out to the resources used along the way.
What we’re building
For this setup, I have two Raspberry Pi’s that will be used in a “Controller / All-in-one” and “Compute” node type setup. Here they are:
More specifically, the architecture will look something like this:
The rPI’s themselves are the Model B.
Getting an OS onto the rPI
This was likely one of the easiest steps. In this case I used the directions provided by the Raspberry Pi folks, installed Noobs onto an SD card, and on first boot selected Raspian. Additionally, I over clocked both Pi as high as they would run, and reduced the video memory to 16MB.
Connecting to the rPI
Once installed, I configured the wifi whilst I still had it connected to a monitor. From there, however, everything is DHCP, so how to find them? For that, I used the following:
$ sudo nmap -sP 10.0.1.0/24
Nmap scan report for 10.0.1.16 Host is up (0.51s latency). MAC Address: 80:1F:02:BC:07:45 (Edimax Technology Co.)
From there, you can ssh to the rPI using:
ssh email@example.com (or putty on Windows)
Building an LXC compatible Kernel
This step took a REALLY long time. Over 5 hours or so. Before you get started, you will want to install screen and run these commands from within a screen session. It will make your life easier should the network flake out in the middle of this process.
sudo apt-get update && sudo apt-get install -y screen
Once you are in screen you can change windows and otherwise operate using some of the bits found here.
The most comprehensive / working set of steps to get LXC running I found were these. You will need to complete all of them before moving on.
Launching an LXC container
After you’ve let the rPI do it’s compiling and rebooting run this command to ensure that LXC is happy enough to work:
# lxc-checkconfig --- Namespaces --- Namespaces: enabled Utsname namespace: enabled Ipc namespace: enabled Pid namespace: enabled User namespace: missing Network namespace: enabled Multiple /dev/pts instances: enabled --- Control groups --- Cgroup: enabled Cgroup clone_children flag: enabled Cgroup device: enabled Cgroup sched: enabled Cgroup cpu account: enabled Cgroup memory controller: enabled --- Misc --- Veth pair device: enabled Macvlan: enabled Vlan: enabled File capabilities: enabled Note : Before booting a new kernel, you can check its configuration usage : CONFIG=/path/to/config /usr/local/bin/lxc-checkconfig
Next up, you will need to complete these instructions to build and launch your first LXC container. Make sure it launches before you attempt to move into part 3.
Wee! So, 5 hours or 7 or so. Whatever… it’s LXC on an rPI! You did follow these directions on both units, right? It’s ok if you didn’t, the ‘controller’ Pi will still work with a single compute Pi.