First, getting headless.

I will not be using the "Raspberry Pi" as "a common PC"; there are already too many of these at home. And well, for the use-case I am thinking of, it is not needed. So the first step is to make it "headless".

For my initial experiment, I took the default Linux distribution "Raspbian wheezy" (16/12/2012); I preferred to start with the "official" distribution (I assume, the most stable and the easiest to begin with). 
I made sure I would have at least:
  • A connection to the screen: that meant for me a cable HDMI to DVI.
  • A network connection to my home modem.
  • A USB keyboard.
Everything went well, except that the keyboard I used (a Logitech Wireless keyboard K340) did not work out of the box. For some obscure reason, if the USB dongle is connected at boot-time, I don't get the keyboard to work; but, if I unplug and plug again the dongle after the RPI booted, it worked just fine...

After that I could finally start. Good thing is that the configuration tool ("raspi-config") has the menu for enabling the SSH server. So after changing the default user password, extending the root partition to fill the SD-card (I bought a 8G) and enabling the SSH daemon, I was almost ready.
Apparently by default there is no password assigned to the "root" user; but well, for safety, I preferred to disable SSH root login, just in case. This is done by editing the SSH daemon configuration file "/etc/ssh/sshd_config" and make sure that "PermitRootLogin" is set to "no". Voila, at the next restart I will be ok.

The final step to make the RPI headless is to ensure it will always get the same IP address. There are two simple solutions in my case:
  1. Make sure my home modem assigns a static lease IP address for the RPI (based on the network MAC address).
  2. Configure the RPI network to use a fixed IP address.
Unfortunately, 1) failed badly... :-( The Belgacom "BBOX" modem lost the DHCP static lease bindings at the next reboot of the box :-( So for now, 2) is the way to go.

This is done by editing "/etc/network/interfaces" and making sure to write the following content

iface eth0 inet static
        address 192.168.1.100
        netmask 255.255.255.0
        gateway 192.168.1.1

Now, my RPI is ready. I don't need the screen and the keyboard. All it needs is USB power and network. Connected to the USB port of the modem, it boots when the modem is up and I can remotely connect to it via SSH, everywhere... from home, at least for now.

Comments

Popular posts from this blog

ZWay: getting the device list.

First steps with the ZWay library

Libcurl: perform a REST HTTP PUT