Setting up a Raspberry Pi headless (Without monitor or keyboard)

avatar

image.png

You just got a brand new Raspberry Pi 4 and want to get it set up quickly. You don't have a spare monitor and keyboard/mouse to set it up, or you just don't want to use one.

Almost every Raspberry Pi (I have around 10 personally, and ordering 6 more) I have has been set up and used headless.

Unless you are using a Raspberry Pi for a gaming console (Retro Pi), Media Station (Plex), or as a desktop, there is really no reason to use a keyboard, mouse, and monitor. I'm going to show you how to avoid all that.

Find your Raspberry Pi's IP address

You need to know the address of the Raspberry Pi before you can connect to it. You have two options here, edit the configuration files on a PC and give it a fixed IP or discover the IP address on the network. I recommend the second option and I will show you how to do this.

Use nmap to discover your Raspberry Pi

You will need to install nmap to be able to scan your network for your Raspberry Pi. On Linux this is as simple as sudo apt install nmap, if you are on Windows or Mac the install is a little more involved.

Visit https://nmap.org/download.html and download the binaries for your platform. The installation is very simple, just basically say yes to everything.

Nmap is a command-line utility but there is a GUI solution available as well. Since finding your Raspberry Pi is one simple command, I'm going to just recommend using the command-line available in the default install.

You need to know your network and subnet mask to do this scan, but in most cases, you will be using a class C subnet and 192.168.1.0 network. If you are using something different I hope you would know what this is, for now, I will assume you are using these defaults.

nmap -sP 192.168.1.0/24

This should display all devices on your network and the associated IP.

You are looking for a device that announces itself as Raspberry Pi Foundation.

This is the IP address you will need to connect to the Raspberry Pi remotely.

Connect to the Raspberry Pi

This next step may or may not work, but let's give it a try and if it doesn't work I will tell you how to turn on SSH.

Depending on the model, version, and distribution, SSH may or may not already be turned on.

From any machine on your network use your favorite ssh client to ssh into the IP you discovered above. If you are able to connect and asked to save the host to your known hosts file, you are good to go. You can use SSH to administer the Raspberry Pi and do most anything you can do locally, you can even install an X Window client on your PC and access GUI applications and complete X window sessions.

If you cannot connect via ssh, let's turn that on.

Connect the SD card to the machine you used to write out the installation image.

You should see the first partition named Boot show up in your file explorer.

On this drive, create an empty file named ssh, if you are using a text editor make sure it doesn't add the extension txt. If you are in Windows, you should make sure to turn on viewing known extensions so you can be sure it is not created as a .txt file.

Remove the SD card and place it back into the Raspberry Pi and boot.

You should now be able to ssh into the Pi and tinker away.

This should save you some time and money whenever you want to tinker with a Raspberry Pi.

Now for some Raspberry Pie!
image.png


Securely chat with me on Keybase

Why you should vote me as witness



0
0
0.000
4 comments
avatar

Marky, I've always been fascinated with Raspberry Pi devices, but never really went out and got one. Mind you, I'm not a programmer. That being said, my daughter has been getting into programming/robotics recently. Do you think a Raspberry Pi device is something good to help her cut her teeth into programming?

0
0
0.000
avatar

Most certainly. I believe kids are were doing the devices shine.

0
0
0.000
avatar

Nerdy! I am a noob! LOL, my first impression about "Raspberry Pi" was literally a food! Hahaha... But when I read and look at the image, oh my vegetable salad! Electronics including IT solution! Hahaha...

I have a knowledge but not wider than yours! LOL

0
0
0.000