Setting up a Headless Raspberry Pi with Raspbian Lite

Raspberry Pi 3b+

Funny thing as I started writing this article. I just was not feeling up to the task and did not want to grab an extra monitor and keyboard from the attic and asked myself if there was a way to setup Raspbian on a Pi without having a monitor and keyboard attached? Well actually there is, and it is not difficult at all.

1) Download Raspbian Lite Image

Go to Raspbian and download the lite image.

2) Burn your Image to your SD Card

I have been using Etcher and have been pretty happy with it so far. Another option is Win 32 Disk Imager.

Etcher

3) Eject and SSH

Now eject your card after it is done and reinsert it. Once your new drive letter is showing, navigate to it. We are going to place a file in the root of the drive called ssh, lower case. You need to have your ‘show file extension’ option on in Windows. The file will have no content, zero bytes.

Raspbian Directory

4) Boot Raspberry Pi and Locate it

Now put your SD card into your Pi, plug in your ethernet and let it boot. Since it has to resize the root partition it will take a minute or two. While this is happening, take a problem like Zenmap or Nmap and locate your Raspberry Pi. When using Zenmap you probably want to use the quick scan or better, so you will get the mac address without having to dig for it.

I have a lot of Raspberry Pi’s scattered across my networks but the one with an address of 192.168.0.133 is our target. From here we can simply putty to our new Raspberry Pi. Your default credentials will be…

Login: pi
Password: raspberry
Raspberry Pi Login

5) Setting Static IP address, Finishing Setup

My first step is to normally change my password, like so.

Shell

Next we will set a static ip address to make the Pi a little easier to find. Run your vi command and edit /etc/dhcpcd.conf and make the following changes to fit your environment.

Shell
hostname
persistent

option rapid_commit

option interface_mtu

require dhcp_server_identifier

slaac private

interface eth0

static ip_address=192.168.0.10/24
static routers=192.168.0.254
static domain_name_servers=192.168.0.6

Now either restart network services or reboot and you should be able to ssh back into your box at the new IP address.

Continue Reading