Installing Mono on Raspberry PI 2

I want to use my PI as a web server.  I use the SmartThings hub for my home automation and I want to customize some of the functionality.  I want to create an application that can receive the data from their cloud and display it on my site.  I hope to do some analytics and maybe create a more robust and rich rules engine, but we will see.

Anyways, to do any of that I need to get my environment setup.  I really enjoy working in c#, so I need to get Mono installed.  Getting Mono installed on the PI is pretty trivial.  You just need to add the source to the apt source list.  The Mono project website has the commands for a Debian based system.

> sudo apt-key adv --keyserver --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update

Now your repository is ready to install Mono.  I want to load the complete Mono suite.

> sudo apt-get install mono-complete

Once that is done, let’s check the version to make sure we have what we expected.

> mono -V

If all went well, you should see an output that looks similar to this one.

> mono -V
Mono JIT compiler version 3.12.1 (tarball Fri Mar  6 23:28:08 UTC 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors.
	TLS:           __thread
	SIGSEGV:       normal
	Notifications: epoll
	Architecture:  armel,vfp+hard
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen

Let’s create a simple console application and make sure that it compiles and runs.  In nano, lets write some code.

using System;

public class Program
        public static void  Main(){

        Console.WriteLine("Hello World");

Save that file as test.cs, then compile it (mcs test.cs).  If it compiled without an error, we should be able to execute the executable and see Hello World.  Now that we have our .NET environment setup, we can start adding the the environment. I want to use Postgresql as the data store for now, so that will be up next.

That was pretty painless. For kicks, I am going to reboot now.