Friday, June 29, 2012

Headless raspberry pi on the network

A raspberry pi finally arrived. Amazing embedded linux platform for very little money.


I'm not really interested in using it to drive a TV, but more as an embedded device for some ham radio project, so I wanted to get it on the network in a headless configuration that I could easily locate. Here's what I did:

  • Grabbed the recommended Debian Squeeze image from here.
  • Wrote it to an 8GB SD card using dd on the mac as per instructions here.
  • Mounted the card and enabled remote ssh by "sudo mv /boot/boot_enable_ssh.rc /boot/boot.rc"
  • Unmounted the card, stuck it in the raspberry pi, connected ethernet
  • On my Mac, did an "arp -a" to note the network devices on my lan
  • Powered up the raspberry pi (I'm using an iPhone charger which seems to work fine)
  • Waited a few minutes, until the lights stabilised, did another "arp -a" and looked for new ip addresses
  • In my case "ssh pi@10.0.1.16" (but your address will be different) {password is 'raspberry'}
  • I'm in! For convenience I create my own user account using "sudo useradd -m USERNAME" and then add the account to /etc/sudoers
The Debian image only uses 2GB of my 8GB card, so I followed the instructions here to resize the root partition up to use it all. After a reboot, it looks like this:


I prefer not to give things fixed IP addresses so to make it easy to locate on the network I install avahi-server with "sudo apt-get install avahi-daemon". Then I add the following configuration file as /etc/avahi/services/ssh.service


Now I can simply "ssh raspberrypi.local" to log in.


I must be getting old, but it's astonishing that I'm using a computer for under $50 that is much more powerful than systems I used to share with dozens of users only a few decades ago.



Now to think of a good application for it!

6 comments:

  1. William VK3ADB9:58 AM

    GHPSDR3 perhaps?

    You could you run the hardware server section of GHPSDR3 for a softrock/RTL2832U on the RaspberryPi at the antenna feed point leaving the dspserver and GUI client to run on your shack PC.

    ReplyDelete
  2. I cannot find avahi-server. Was it avahi-daemon?

    ReplyDelete
  3. Ah, my apologies. I'll check when I get home and update it. You're probably right.

    ReplyDelete
  4. Yes, it's avahi-daemon. I have updated to the text of the article. Thanks Dennis and my apologies to anyone else who was led on a wild goose chase.

    ReplyDelete
  5. thanks for the tutorial. it was very useful and worked like a charm. if you would take one suggestion, you could have the avahi config file as text instead of image. i would rather have copy-pasted it than typed it.

    ReplyDelete
  6. Thanks Rafael,

    Yes, sorry about that. It's a while ago but I must have had trouble with formatting.

    There's a bunch of examples here for example.

    Best wishes,

    Peter

    ReplyDelete