Initial set up

Insert the SD card into the Pi and attach the Audioinjector card. Don't connect the Pi to Ethernet at this point. Just connect a TV or monitor with HDMI and a USB keyboard, and apply power. Login with user 'pi' and password 'raspberry'. You'll find an annoyingly coloured shell prompt. Don't worry, this and many other nuisances will soon be cleaned up and the Pi made usable.

First, set up networking. Raspbian is a bit bizarre: it uses a DHCP client to configure all the networking, even if your're not using DHCP. I guess that's OK for a toy computer that wants to be plug and play. We need to give it a static IP address so that it's usable as a headless device and server for radio applications.

Edit /etc/dhcpcd.conf and add something like

interface eth0

static ip_address=192.168.2.37/24
static routers=192.168.2.1
static domain_name_servers=192.168.2.1 8.8.8.8

and save the changes. I'm using 192.168.2.37 as the IP address for this Pi. You need to use the same network prefix as your LAN is using, usually that is 192.168.1 or 192.168.0, check on your ADSL/router admin page if you're not sure. The router admin page should have a section for DHCP config. This hands out dynamic IP addresses to PCs on your network. You'll probably find an admin option to reserve a block of static IPs, or conversely assign a block of dynamic IPs. The entry for 'routers' and the first DNS address should be that of your ADSL/router. I've included 8.8.8.8 (Google's DNS) as a fallback in case your router doesn't do a domain name service.

Now enable ssh connections with

sudo systemctl enable ssh

This clunky business of prefixing commands with sudo will soon be dispensed with. Connect the Ethernet port to your LAN, and reboot with

sudo shutdown -r now

Allow the Pi to reboot and you should be able to ping it from another PC:

ping 192.168.2.37

and connect to it with an ssh client from your workstation PC with:

ssh pi@192.168.2.37

The default password for the pi account is 'raspberry'. Now you can remove the keyboard and monitor. These are no longer required and from now on the Pi will run 'headless'.

Cleaning up

The Raspbian version of Linux operating system comes equiped with many annoyances. Fortunately they are easily fixed.

First, enable the root account so that you don't have to prefix commands with sudo.

sudo passwd root

and enter a convenient password, it will prompt twice.

Edit the ssh configuration file /etc/ssh/sshd_config to allow root login via ssh. Find the commented-out line that mentions PermitRootLogin and change it to

PermitRootLogin yes

and save.

Restart the ssh daemon with

killall -HUP sshd

which sends a hangup signal to sshd which tells it to reload its configuration. It will drop your ssh connection. Now you should be able to log in as root from your workstation, using

ssh root@192.168.2.37

Now you no longer have to use the 'pi' account or prefix commands with sudo. You will probably find that the problematic colours used in the shell prompt and output from some programs have gone too.

Now to set things so that you don't have to give the root password every time you log in. Create a directory /root/.ssh using

mkdir /root/.ssh
chmod 700 /root/.ssh

Use a text editor to create a file /root/.ssh/authorized_keys (note the American spelling) and copy/paste the public key of each of your workstations into this file. Each key should be on one (very long) line. Save, and set the file permissions with

chmod 600 /root/.ssh/authorized_keys

Remove the verbose login message by creating an empty file called .hushlogin in the /root directory:

> /root/.hushlogin

It is also necessary to change the password of the 'pi' user to close a security hole. Run

passwd pi

and give the pi account a new password.

Now if you log out and back in again, you'll get a quick and quiet login. You should now be using the root account for everything.

If your workstation is running X-Windows, enable remote display by editing /root/.bashrc on the Pi and add the following lines at the end:

[ "$SSH_CLIENT" != "" ] && {
  ip=$(echo $SSH_CLIENT | sed 's/ .*//')
  export DISPLAY="$ip:0"
}

You'll also need to run an xhost command on your workstation to give the Pi permission to use your workstation's display.

Now you may find, if you run the 'df' command, that the root filesystem is the size of Raspbian image you installed from - not the size of the SD card you used. Expand the file system to use all the SD card by running

raspi-config

and go into option "7 Advanced Options" and select option "A1 Expand Filesystem". When that's done, exit raspi-config and reboot with

shutdown -r now

Now set the hostname to something other than the default 'raspberrypi'. I'm going to use 'rp5' as the hostname (you can guess how many other Pi are in use here).

echo rp5 > /etc/hostname

Edit /etc/hosts to add entries for the other computers on your LAN which have static IP addresses. While you're in there, change the entry for 127.0.1.1 to use your chosen hostname.

If you want to activate the Wi-Fi interface, run raspi-config and select option "2 Network Options" and "N2 Wi-fi" and enter the SSID of your Wi-fi hub and the passphrase if you use one. Then edit (again) the file /etc/dhcpcd.conf and add the following to set the wireless lan interface to a static IP

interface wlan0

static ip_address=192.168.2.38/24
static routers=192.168.2.1
static domain_name_servers=192.168.2.1 8.8.8.8

Note the use of a different IP address for the wireless interface.

While you're in raspi-config, set the timezone to UTC with options "4 Localisation Options", "I2 Change Timezone", "None of the above", and "UTC".

Finally, update the installation to the latest spec by running

apt-get update
apt-get dist-upgrade -y

which may take a while to run. As a final check, do another reboot with

shutdown -r now

and when it comes back up, make sure you can ping both its wired and wireless IP addresses and log in with ssh on both.

Now the Raspberry Pi is beginning to resemble a usable computer. Next step is to install and configure all the packages you will need for radio work.


Back to Linux Up to Index   Next to Radio