This post will show you how to setup a Raspberry Pi

Setting up the PI

Its very simple to setup a SD card for a Raspberry Pi:

  • Reformat the entire SD card to FAT32
  • Download the latest version of Raspbian Lite from here
  • Use a program, like Etcher to write the zip/iso to your newly formatted SD card

At this point you can bootup your newly formatted Raspberry Pi, but I always complete these additional two steps to get SSH access working on my Raspberry Pi and enabling WiFi connecting for the Raspberry Pis that support Wireless Internet (Raspberry Pi 3 and Raspberry Pi Zero W):

  • Create a blank file called ssh in the boot folder of your SD card
  • Copy this template to create your own wpa_supplicant.conf file. Put this file in the same boot folder and add your SSID between the quotes and your wifi password between the quotes
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 
update_config=1
country=US

network={
    ssid=""
    psk=""
}

Congratulations, your Raspberry Pi is ready to go and should enable SSH access and automatically connect to your wifi. By default, the login is pi and the password is raspberry.

Note: On bootup, the .ssh and wpa_supplicant.conf files will be deleted. This is okay, as the settings are written back to the raspberry pi

Connecting to zerotier

Now you can connect to your pi. However you can only connect to it while you are on the same network. We can use ZeroTier to connect to the pi from anywhere.

  • Sign up for a ZeroTier account if you do not already have one
  • Set up a ZeroTier network that you would like to use
  • Install zerotier on your pi
    • curl -s https://install.zerotier.com | sudo bash
  • To ensure ZeroTier starts on system boot
    • sudo systemctl enable zerotier-one
  • Connect to your ZeroTier network
    • sudo zerotier-cli join [Network ID]
    • you will have to accept the connection from your ZeroTier account.
  • To have your Raspberry Pi automatically join the virtual network on system boot, simply run
    • sudo touch /var/lib/zerotier-one/networks.d/[Network ID].conf
  • You can now reboot your pi and you will see on the ZeroTier network page that it connects automatically when it boots