Raspberry Pi is an affordable, small board that you can turn into a tiny desktop computer. You can attach a display, mouse, and keyboard - that's all you need anyway. However, most folks are reluctant to try it since they assume that the installation is tricky.
Many users either don't have a micro HDMI to HDMI cable or a monitor/display. Also, getting a cable just for aone-time setup seems like too much trouble.
Hence, I am sharing this guide for all those users who want to set up Raspberry Pi 4 without using a display or a monitor. Of course, you'll need a Windows PC or a Mac to complete the setup. That will result in a headless Raspberry Pi, which means it is controllable mostly through the Command Line interface. However, you can get a local web interface that works over desktop and mobile browsers.
After several crashes and some practice, I can now set it up in a matter of minutes. The majority of time is spent downloading the Raspberry Pi OS. Formatting the micro SD memory card is easy. Recommendation: Micro SD cards with Class 10 speed and an SD adapter. Helpful when you want the 64-bit OS version to run smoothly and also involve data transfer using the memory card.
Slower ones will work if you plan to use it to run only Pi-hole, a Linux-based network-level application for blocking Internet trackers and advertisements. For this Pi series, I'll primarily focus on setting up headless Pi to be used with Pi-hole and as a Samba file server over the home network.
This guide appears to be lengthy for the first time when you start the prep work. Once you get a fair idea of what goes into the setup, it'll only become a matter of minutes.
- A Raspberry Pi unit (version 3 or 4, preferably) with a case.
- A microSD card (preferably Class 10) in FAT32 file format.
- Decent Internet connection for downloading software.
- Windows PC or Mac to load the OS and set up the memory card.
Stage A - Get Raspberry Pi Imager and Raspberry Pi OS
Step 1 - Download the Raspberry Pi Imager.
Get the Raspberry Pi Imager app to flash the Pi OS image on the memory card.
Step 2 - Download the latest Raspberry Pi OS image from the official site. Get the 64-bit Raspberry Pi OS Lite beta image.
Then pick the zip file and download it. If you're in luck, the download speeds will be decent. Unzip the .img file from that archive. The only reason I recommend a 64-bit version because the platform itself is shifting to that gradually. So might as well get ready for it.
We're using the Lite version for this guide because it doesn't have the unwanted, unnecessary GUI elements and makes the OS leaner. I recommend downloading the OS separately to avoid the risk of data corruption with the OS file when downloading from the Pi Imager.
While the download happens since the servers might be particularly slow, let's prepare the hardware.
Stage B - Preparing the Hardware
Step 1 - Whether Raspberry Pi 3 or 4, you would want to keep it clean and cool while it functions. Get a decent case. There are several case options with built-in fans available - plastic, acrylic, and even aluminum-based ones. Don't splurge too much unless you plan to use it as a full-blown computer.
Connect the Raspberry Pi to the power and keep it ready for action. For reliable connectivity, I used a Cat 7 Ethernet cable to connect the Pi 4 with the router instead of settling for a Wi-Fi network.
Step 2 - Format the microSD card using an adapter on Windows PC or Mac.
Download the SD Card Formatter from the official SD Memory Card association site and install it on your PC or Mac.
Of course, there are other ways and if you are familiar with them, use one of them.
On Windows, you can use the native File Explorer to format it. From File Explorer, right-click on the microSD card. Remember to choose FAT32 as the filesystem.
On Mac, you can use Disk Utility to format it. However, I'd recommend using Terminal for it is faster.
Feed the following command in the Terminal to figure the disk number of your card:
In my case, Mac shows the card's mount location as /dev/disk 2. Similarly, you'll have to figure it out on your Mac.
After that, type the following command and hit the return key to format the card with a FAT32 partition.
Here * represents the number in the mount location, just like it was disk2 on my Mac.
Step 3 - Launch the Raspberry Pi Imager. Then, click on the Choose OS button and select "custom OS" from the list. Then navigate to the folder where the Pi OS .img file is and then select it.
Step 4 - Click on Choose SD card and navigate the Finder to pick the SD card on your PC or Mac. After checking and confirming everything, click Write.
Now take a break from the computer. I'd recommend not running any other process alongside, for it may slow down the writing speed. People with a beefed-up system with at least 16GB of RAM need not worry much.
Stage C - Enable SSH to Set Up Pi
Since you won't be using a monitor or any display, it's better to set up SSH service right from the installation stage. The best part is you don't have to run most commands.
You need to create a file named SSH without any extension and transfer it to the root directory of the microSD card, which now reads as boot. So the SSH file should appear with other files as soon as you open the boot card.
After that, insert the microSD card in the Raspberry Pi and boot it. Give it at least 5 minutes before you proceed to the next stage.
Stage 4 - Run The Setup
After inserting the microSD card in the Raspberry Pi board, give it a couple of minutes after booting. Then open the Command Prompt on Windows or Terminal on Mac. When you connect to Pi via SSH for the first time, you'll get a security warning about adding the key to your computer. Enter Y and proceed.
When asked for the password, enter raspberry as the password and then take it away from there.
That will bring up the Raspberry Pi's configuration interface. Remember, you can use Tab to cycle between options and Enter for selecting an option and confirming your choice.
From there, you need to do two things:
- Change the password for Pi from System Options > S3 Change Password for Pi User
- Change the Hostname for Pi on your Network from System Options > S4 Set name for this computer on a network
After that, pick Finish and reboot the Raspberry Pi by entering the command reboot in the command line interface. Once it reboots, your Raspberry Pi should be ready to be controlled using a Command Prompt on Windows or Terminal on macOS.
After hitting a roadblock several times, I no longer depend on a display to get my Pi 4 set up running. I am sure these steps will get you up with speed with Pi setup. In the next guide, I will cover how to set up Pi-hole on your Raspberry Pi configuration to block unwanted trackers and ads.