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:
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:
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.
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:
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:
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:
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:
Make sure to change it to something else by typing this command:
Set up Your RPi3
After successfully connected to the device via SSH you may want to set it up according to your needs:
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:
iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet dhcp
Save the file by pressing ESC and typing (followed by Enter):
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
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):
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:
You will use this new IP to connect to Raspberry via SSH wirelessly from now on.
To test the new setup, type:
unplug the cable from your device and connect using the new IP:
ssh [email protected]<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 WiFi now.
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
Please let us know what you think in the comments section below.