Raspberry Pi – First Steps

We are going to cover a few important things to know and steps to take with your new pi. Some you should do even before you power on your pi. Please note these all correspond to the default Raspbian linux. Check out the official download and install docs for that part.

Add ssh and wpa_supplicant.conf files to the boot drive

Before you insert that microSD card into the pi, let’s make your life a little easier to connect to it! This also make it simpler on those of us that are going to use it as a headless (i.e. without video output) system.

Connecting to wifi

If your pi supports wifi out of the box, or has an adapter that doesn’t need special drivers, you can get it connected to your network without even having to plug a keyboard in!

Create a file called wpa_supplicant.conf on the boot drive of the microSD card with the following content. Make sure to change the country and network details as necessary.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US 

network={
        ssid="<name of your network>"
        psk="<password to your network>"
}

This will automatically be copied to /etc/wpa_supplicant/wpa_supplicant.conf on boot and allow it to auto connect to your network.

Pre-enable ssh

By default the pi comes with ssh turned off. Sounds dumb, but it’s for security, as all Rasbpian images share the same username and password to start out with. However, it is possible to enable ssh by simple created a file on the boot drive named ssh. It doesn’t even have to have any content!

Now that you have a method to access the pi, either through video and keyboard or ssh, lets move on.

login and hostname

Look, we’re all human, and I sometimes forget these myself. So adding the default’s for the Raspbian system here so none of us ever have to look dumb.

username: pi
password: raspberry
hostname: raspberrypi

The hostname is good to know when you first plug it into your network, as you might not know it’s ip address. Thankfully, you should be able to directly ssh to it at ssh pi@raspberrypi with password raspberry.

Change the default password

First thing you should do to better protect your pi is change the password that everyone knows. You can do this by either typing passwd or going into the raspberry pi config with sudo raspi-config.

Expand the filesystem

If you used NOOBs, no need for this. However if you manually flashed Raspbian to your microSD card, it probably has more space on it than they allocate by default. So you should run this command just in case.

Go into sudo raspi-config, then Advanced Options and run Expand filesystem and reboot.

Change the time zone

There are several Localization options when you run sudo raspi-config. You may need to adjust what type of keyboard or locale you want to use. However the most common is switching timezones, so don’t forget to do that!

Networking

Last few things, almost ready to play!

Hostname

Remember how we could find the device on the network with raspberrypi? Well, if we ever hook up another one, we want to make sure we have different names for each. So run sudo raspi-config yet again. Go to Network Options and Hostname. Name it something cool like TazerFace or Purposeful, like WatchTheToddlerFallOutOfCribCamera2.

SSH

If you haven’t already set it up with the ssh file on the boot drive, make sure to set it up now if you want it. sudo raspi-config, go to Interfacing Options and SSH and enable it. Make sure all users have secure and unique passwords before doing this!