rpi

How to Easily Set up Raspberry Pi 3 With No Keyboard and Monitor

Mario Dian Sep 26, 2016 5 min read

You're all excited about your new Raspberry Pi 3 just to find out you can't use it.

It comes with no display, nor any input device and you don't have an extra keyboard and a monitor at your hand.

Don't worry you can run it "headlessly" by connecting remotely via SSH straight from your computer. No external monitor or keyboard is needed.

I'll walk you through all the necessary steps on OS X (sorry I only use Mac).

The process is also fairly similar to various UNIX-like operating systems.The only difference is that you will need to use "df" instead of "diskutil".

Download Raspbian OS Image

Because we don't need (or have) a screen attached to our Raspberry Pi 3, downloading full-featured operating system isn't necessary.

We will install Raspbian Jessy Lite instead.

In case you're downloading the torrent file, make sure you have some torrent client such as Folx.

Install Raspbian on MicroSD Card

Once the image is downloaded, insert your Micro SD card to SD Memory Card adapter and plug it in your Mac or an external card reader.

Your card should be automatically mounted.

Open the console on your computer (called "Terminal" on Mac) and copy & paste following list of commands. Ready?

Look at the partition table to get the card device identifier:

diskutil list

Look for the name of your card (usually the manufacturer's name like Sandisk, Kingston, Verbatim etc) and take note of the device ID which should look like this:

/dev/diskN

In my case, the card device is /dev/disk2 (not /dev/disk2s2).

P.S. If you don't have a Micro SD to SD Memory Card adapter, get one on Amazon for less than $5.

SanDisk Micro SD to SD Memory Card

This SanDisk micro SD to SD memory card adapter is designed for use in devices with a standard secure Digital slot. It features a built-in write protection switch to keep your data safe!

Shop on Amazon

Format as Fat 32

Locate the filesystem type in the same list. If it says DOS_FAT_32, WINDOWS_FAT_32, or simply FAT_32 you can safely skip this step.

If it says Apple_HFS or anything else, format it:

sudo diskutil eraseDisk FAT32 RASPBIAN MBRFormat /dev/disk2

Check the filesystem again, it should say FAT_32 now:

diskutil list

Note that the command also changed the name of the card from the manufacturer's name to RASPBIAN.

Copy the Image on the Card

After your Micro SD card is ready, unmount it:

diskutil unmountDisk /dev/disk2

First, locate the image on your disk and take note of the path:

find ~/Downloads -name *-raspbian-jessie-lite.img

then write the image to the card using "dd" command:

sudo dd if=<copy the above image path> of=/dev/rdiskN bs=1m

Please reconstruct the command yourself according to your own environment, because making a mistake may cost you your data!

If you struggle with reconstructing it here's an example (copy and paste at your own risk):

sudo dd if=/Users/mariodian/Downloads/2016-05-27-raspbian-jessie-lite.img of=/dev/rdisk2 bs=1m

Note that the device identifier has changed from /dev/diskN to /dev/rdiskN (see the extra "r"?).

It tells "dd" to write to the raw disk device instead of a buffered one. This significantly speeds up the copy process.

Connect to Your Raspberry Pi 3 via SSH

After the image is successfully copied to the card, take it out of the adapter and plug it into your RPi3.

Connect the device to your Mac with an ethernet cable and type:

ifconfig eth0

Take note of the "inet addr" which is your Raspbery's IP address. In my case, it's 192.168.1.116

Connect to your RPi3 using an ssh client:

ssh [email protected]

You will be greeted with the following message:

The authenticity of host '192.168.1.116' can't be established.RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.Are you sure you want to continue connecting (yes/no)?

Since we're working in a local environment it's safe to ignore this message. Just type "yes".

You will be prompted to type a password. The default password for Raspbian is raspberry.

Make sure to change it to something else by typing this command:

passwd

Set up Your RPi3

After successfully connected to the device via SSH you may want to set it up according to your needs:

raspi-config

Just follow the explanation of each step. If you have any issues, just let me know in the comments below.

Set up WiFi on Raspberry

Because we are lazy, we want to be connecting to our Raspberry over WiFi instead of the cable.

Open /etc/network/interfaces on your RPi3 device:

sudo vim /etc/network/interfaces

and replace its content with:

auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Save the file by pressing ESC and typing (followed by Enter):

:wqa

Now open /etc/wpa_supplicant/wpa_supplicant.conf:

sudo vim /etc/wpa_supplicant/wpa_supplicant.conf

and replace it with:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1
network={        
	ssid="<YOUR WIFI NETWORK NAME>"        
	psk="<YOUR WIFI PASSWORD>"
}

Make sure to edit the file according to your WiFi settings. Note that your WiFi security configuration may differ.

If you have any issues with this setup remove everything from the "network" object except "ssid" and "psk".

The system should be smart enough to figure out correct settings on its own.

Save the file by pressing ESC and typing (followed by Enter again):

:wqa

Wait few seconds and check that you are connected to the router:

iwlist wlan0 scan | grep ESSID

It should print out your WiFi network name. If it doesn't, restart the wireless interface manually:

sudo ifdown wlan0
sudo ifup wlan0

Run the previous command again to check that you are connected now.

If everything looks fine, get the new IP address and take a note of it:

ifconfig wlan0

You will use this new IP to connect to Raspberry via SSH wirelessly from now on.

To test the new setup, type:

exit

unplug the cable from your device and connect using the new IP:

ssh pi@<new IP address>

Because the IP has changed you will be greeted with the similar message as the first time. Type "yes" again and use your new password to log in.

Congratulations! If you've done everything correctly, you should be connected to your RPi3 over WiFinow.

If you ran into any issues, let me know in the comments below.

We will take a look at how to install full Bitcoin node on our new toy in the next article.

In case you're still deciding on buying Raspberry Pi 3, you can get the complete Starter Kit for just $68.99

Get RPi3 on Amazon Now

Found this valuable?

Please consider supporting us. Thank you!

Support us
WRITTEN BY

Mario Dian

I'm an Anarchist, Rothbardian, Bitcoiner and Travel Hacker. Also founder of @freedomnodecom.

Show comments