Wednesday, June 12, 2013

Raspberry Pi

I haven't done much with the Raspberry Pi since I bought it, but having semi-volunteered to give some talks at a forthcoming open day, I thought I would use it as a web server to interface with an Arduino and some hardware.  So I set it up again.

SD Card

I bought a new 16 gigabyte SD card for a tenner from the students' union shop. I think I paid about £130 for a 2 gigabyte hard disk back in the mid-nineties (I have a pile of them propping up a bookshelf in my office).  Downloaded the raspbian image on to my Linux netbook, popped the SD card into the slot, and created the image (the card was automounted as /dev/sdb1, hence the first command):
    umount /dev/sdb1
    dd if=2013-05-25-wheezy-raspbian.img of=/dev/sdb bs=4M

Network

The RPi was already registered for the campus network, so I haven't bothered with any of the static network address recipes - it picks up its address through DHCP.

Additional software

I installed (using apt-get) the following packages:
  • apache2
  • php5
  • libapache2-mod-php5
  • xfce4
  • tightvnc
  • arduino

VNC

I want to run the RPi headless most of the time, and don't want to have to muck about with monitor cables and spare keyboards when I do need to use the GUI.  Initially, I took the RPi up to one of the labs where I could pinch a monitor with DVI input, and work in peace.  These instructions worked to get VNC up and running.  I used vinagre and remmina to test the setup - VNC is now starting reliably at boot time.

Web server

I want the web server to use one of my subdirectories as root (documents in /home/pi/www/htdocs, CGI scripts in /home/pi/www/cgi-bin), so I edited /etc/apache2/sites-enabled/000-default to change the values of DocumentRoot, ScriptAlias, and the permissions on /home/pi/www/htdocs/.

Desktop

I use xfce as my standard desktop (I like Gnome 4 on netbooks, have never got on with Unity).  Selecting that as the default is simple (like most of the commands above, this has to be done using sudo to give yourself root privileges):
    update-alternatives --config x-session-manager
A menu appears, and I was able to choose /usr/bin/startxfce4 as my session manager.

No comments:

Post a Comment