I know I'm a little behind the times here, but I finally picked up a Raspberry Pi single board computer.
It's tiny, the size of a credit card, though taller because of the connectors.
It's about the same size as the Rabbit RCM 5700 with the development board that I use for my proximity card and electronic lock controller, but with many more capabilities.
I followed the standard Raspberry Pi instructions for formatting the SD card and copying the initial install ("noobs") to the SD card. I installed the recommended Raspbian distribution, which at the time of writing is a fork of Debian "wheezy" with hardware floating point enabled for ARMv6.
The first thing I did was change the password for the default user "pi."
Installed any software updates:
sudo apt-get update
sudo apt-get upgrade
My preferred text editor is emacs, so I installed that. You may prefer a different editor, such as vim.
sudo apt-get install emacs
I switched the DHCP IP address with a static IP address to make it easier to log into using ssh. Edit the file /etc/network/interfaces, replacing the iface eth0 inet dhcp line with:
iface eth0 inet static
I rebooted, as sudo /etc/init.d/networking restart is apparently deprecated and it wasn't worth looking up what the new command is. sudo restart was fine.
I created a new user, mainly so I can use the same username across all machines.
sudo useradd -m rickk
sudo passwd rickk
The -m option creates the home directory and populates it with standard files like .profile and .bashrc.
Also edit /etc/group to add rickk to the sudo group, along with pi, so I can log in with my own account and sudo.
At this point, I can log in via ssh using typed passwords, but I prefer to do it using a key exchange, so I don't need to keep typing my password. Log in as rickk and create an empty .ssh directory. Set the permissions
chmod 700 .ssh
I copied the .ssh/authorized_keys2 file from an existing machine to the new machine using scp. Note that if you try to do this using copy and paste, you need to remove the line feeds. Each key must be a single line!
On the machines I'm connecting from, add an entry to ~/.ssh/config to specify the appropriate key file to use.
And with that, I can log in without needing a password over ssh!
The last thing I like to do is edit /etc/ssh/sshd_config and edit the PasswordAuthentication line so it looks like this. It should be commented out in the standard installation, and defaults to yes.
By setting it to no you can only log in using public key encryption, not
using a username and password. While my pi is not currently accessible
from the Internet, this eliminates the possibility of breaking into it
by guessing a password.
While you can use your Raspberry Pi for many things, this one is mostly going to be a server. Not a particularly fast one, but very low power and tiny server. The board has pretty good graphics capabilities, and has some nice I/O support, so there really all sorts of things you could do with it beyond being a tiny headless server.More Servery Stuff
I was a little unsure about how well the pi would function as a server, so why not give it a try? It might be unacceptably slow, or may would better with an external hard drive if the SD card is the bottleneck, but let's give it a try.
I have a lot of code written for Java and Apache Tomcat, so I thought I'd give it a try and see how Java works on the pi. Update January 10, 2014
: Raspbian now includes Oracle Java by default, so the section below is no longer necessary. It works great, much faster than OpenJDK!
Oracle has a great howto
that makes it look easy BUT you can't use Oracle Java with Raspbian. The problem is that Java SE Embedded 7 for ARM v6/7 Linux - Headless install - is configured for SoftFP. Raspbian is configured for HardFP and the two cannot be mixed. There is apparently a pre-release version of Java SE 8 with ARM v6/HardFP, but I didn't really want to go down that road yet.
There are some reports that OpenJDK
works, but is slow
. Other options include cacaovm
I decided to go with OpenJDK mainly because there is a pre-built package for it in Raspbian, which makes it so much easier to install.
sudo apt-get install openjdk-7-jre-headless
Worked great, that was easy!
Oh, look, there's an Apache Tomcat 6 package, too. This is too easy. (Also, there's now a tomcat7 package.)
sudo apt-get install tomcat6
The configuration files are installed by default in /etc/tomcat6. While it's pretty trivial to just download tomcat and use it, using the package does make things more standard and can automatically update using apt-get upgrade, so that's kind of handy (sometimes).
By the way, Raspberry Connect has a nice web browsable package list
I might as well also install MySQL
sudo apt-get install mysql-server
And PHP. Perl was already installed.
sudo apt-get install php5
There's also a full install of Apache web server available, though there are numerous lighter-weight alternatives, as well. I'll wait on this one.
That's enough playing for now. I guess I should think about how I'm going to test and benchmark this now.