Raspberry Pi - Headless setup tutorial
Being a minimalist and a geek today is often doesn't make life easier. Minimalistic, usually small apartments doesn't allow to collect all hardware we would love to have.
It took me a while to decide to finally set up my good, old friend - Raspberry Pi 3 Model B and I did it without having a monitor or even an external keyboard and it was really easy.
To follow this tutorial you will need:
Basic understanding of the Linux systems is not required but may be useful to configure the raspberry to your needs.
1. Download, install and open the Raspberry Pi Imager.
2. Click on CHOOSE OS and select the operating system from the list. For this article's purpose I will continue with a default Raspberry Pi OS (32-bit), but feel free to play with it and install Ubuntu, Manjaro or Kodi.
3. Click on CHOOSE STORAGE and select your SD card.
4. After OS and storage has been selected, please click on WRITE button and wait until writing data process is done.
5. You will see information that you can remove SD card from the reader, but please do not do it yet. We still need to do some configuration.
Now it's time to set up the WiFi connection. After this your Raspberry Pi will automatically connect to the network on the first boot.
6. Open any text editor and create an empty file called ssh, without any extension. Create this file in the main directory of the SD card. During the first boot, if the system will see the ssh file it will automatically enable SSH, so you will be able to access your Pi through SSH (Secure Shell).
7. Create a file called wpa_supplicant.conf in the main SD card direct. This file contains the wireless connection configuration. This is a really important step if you're setting up Raspberry Pi without a monitor and there's no option to connect it to network via LAN cable.
8. Adjust data in for
country to your country code (e.g. US for United States, FR for France, etc.)
psk to match your network SSID (name) and password.
9. The preparation is complete. Save the file, put the card in Raspberry Pi and connect the power supply.
Now it's time to connect to our Raspberry via SSH.
10. Open terminal or PuTTY on Windows.
ssh pi@raspberrypi in the terminal. Enter the default Raspberry Pi credentials:
If everything went right, terminal should return a similar message:
Linux raspberrypi 5.10.63-v7+ #1459 SMP Wed Oct 6 16:41:10 BST 2021 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Oct 30 12:37:03 2021
SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
If terminal is returning error about not resolved hostname, it means that most likely your Raspberry Pi is not connected to the local network. Check the wpa_supplicant.conf file, if data there is correct or use Lan connection for initial configuration.
Connecting to SSH host on Windows is a bit different. We need to use an external program called PuTTY. PuTTY is the most popular SSH client for Windows.
In the Session category (from the category tree on the left side), enter
raspberrypi as Host Name, Port should be set to
22 and SSH as the connection type. Then click Open to run the SSH connection.
Enter the default Raspberry Pi credentials:
11. Change the default password for user pi. This step is optional, this can be done later in the graphical interface setup. If you want to change the password now enter
Changing password for pi.
Retype new password:
passwd: password updated successfully
If you're new in Linux systems there's an important note: Each time Unix systems are asking you to enter the password you will not see any indicator of that (like asterisks or dots) however, you can be sure that you're entering the password if the terminal window is focused.
12. Configure VNC host. If you want to access your Raspberry Pi via remote desktop and use the graphical intherface you have to enable the VNC (Virtual Network Computing).
In the remote SSH terminal enter
sudo raspi-config. This will open the Configuration Tool
13. Select Interface Options.
14. Choose VNC from the list of tools.
15. Configuration Tool will ask you to confirm enabling the VNC Server. Select Yes.
After that you should get an confirmation:
The VNC Server is enabled.
This is the end of work via SSH, you can close the connection. Now it's time to connect to Raspberry Pi through VNC.
16. Open VNC Client. Enter
raspberrypi as hostname.
I'm using the RealVNC, but UltraVNC, TightVNC or any other will also do the work here.
17. Enter the credentials for user pi. Remeber: If you changed the password after connecting to SSH with
passwd command you must use the new one instead of
18. After connecting thre's an initial setup to do. Don't worry if date and time are not correct, we will fix it in a moment.
19. Follow the setup wizard to set up:
- Locale (Language, timezone, keyboard layout),
- Reset password (if didn’t after connecting to SSH)
- Connect to WiFi (if configured via LAN)
- Install updates (Important for security reasons)
20. Setup complete. You can restart the system to apply all changes.
That's it. Now you can play with your Raspberry Pi and set up a web server, a retro-garming console or smart TV. The choice is yours.
Please let me know if you would like to jump into a specific topic with the Raspberry Pi.
My whole career and life is orbiting the technology. Fan of automation and everything that's making your life and job easier.
I was working in different roles, from a stereotypical IT guy in the company, through IT Support, web development.