Popup

Wait! Don’t Go Yet! 👋

Become a Member Today and Unlock Access to All eBooks! 😍

Thousands of eBooks at your fingertips. Read, learn, and grow anytime, anywhere ✨

Install Raspberry Pi OS, Set Up Wi-Fi, Enable and Connect with SSH

In this tutorial, you’ll learn how to get started with the Raspberry Pi by installing the operating system, setting up Wi-Fi, and enabling and connecting with SSH. You can configure everything without the need for an extra monitor, keyboard, or mouse—the Raspberry Pi will be running headless.

1) MicroSD Card for Raspberry Pi

The Raspberry Pi is a computer, and like any other computer, it needs an Operating System (OS) installed.

The Pi doesn’t have built-in storage, so you’ll need a microSD card to install your OS. We’ll install the operating system on the microSD card. I recommend using a microSD card class 10 with at least 16GB of memory.

16 GB microSD card

2) Installing Raspberry Pi OS

There are several operating systems suitable for the Pi. The official distribution for the Raspberry Pi is Raspberry Pi OS, and that’s the one we recommend you install.

1) Start by connecting the microSD card to your computer.

2) Go to the Raspberry Pi Software page.

Top 6

Raspberry Pi eBooks

From Zero to Professional

Raspberry Pi Projects

3) Select and download the Raspberry Pi Imager (a tool to flash the OS on the microSD card) for your computer’s operating system.

Download Raspberry Pi Imager

4) Click on the downloaded file to install the Raspberry Pi Imager.

5) When the installation is complete, the Raspberry Pi Imager will open.

6) Select the Raspberry Pi board you’re using.

Raspberry Pi Imager Select Board

7) Then, select the Operating System. For beginners, and for most scenarios, we recommend the Raspberry Pi OS (64-bit).

Raspberry Pi Imager Choose OS

8) Choose the microSD card where you want to install the OS.

Raspberry Pi Imager Choose Storage

9) Next, choose a hostname for your board. It’s the name you’ll use to connect to your board via SSH later. We’re giving it the name raspberrypi5.

Raspberry Pi Imager Hostname

10) Set your location, time zone, and keyboard layout.

Raspberry Pi Imager - Costumize location, timezone and keyboard layout

11) Then, you need to create a username and password to access your Raspberry Pi later on. Make sure you memorize or save this.

Raspberry Pi Imager - Set Username and Password

12) Set up Wi-Fi with your local network credentials. Don’t make any mistakes here. Otherwise, your Pi won’t be able to connect to your network, and you won’t be able to connect to the Pi via SSH.

Raspberry Pi Imager - Set Network Details

13) Enable SSH with password authentication.

Raspberry Pi Imager - Set Up SSH

14) The following step is optional. You can set up Raspberry Pi Connect or not. For more information about Raspberry Pi Connect, click here.

Raspberry Pi Imager - set up Raspberry Pi Connect

15) Finally, click Next. You’ll be given an overview of your setup. Click Write to start the process.

Raspberry Pi Imager - Write Image

 16) After a few minutes, the process will be completed.

Raspberry Pi Imager - Write Complete

17) When the installation is complete. It will eject the microSD card safely.

18) Now, remove the card from your computer and insert it into your Pi. Then, apply power to the Raspberry Pi to start it and proceed to the next unit.

3) Connecting the Raspberry Pi to the Internet

This method is useful if you want to change the credentials after you already have a microSD card with the OS installed.

Insert the microSD card in your computer.

1) Create a new file called wpa_supplicant.conf and paste the following.

country=PT # Your 2-digit country code
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
    ssid="YOUR_NETWORK_NAME"
    psk="YOUR_PASSWORD"
    key_mgmt=WPA-PSK
}

Insert your 2-digit country code and the network credentials (SSID and password) of the network that you want the Raspberry Pi to connect to.

wpa_supplicant.conf File Raspberry Pi

2) Open the microSD card folder and move the wpa_supplicant.conf file there.

wpa_supplicant.conf file coppied to microsd card

4) Enabling SSH

To access your Raspberry Pi remotely (via a computer on your local network) so you don’t need to connect a monitor, keyboard, or mouse to the Raspberry Pi, you need to enable SSH. SSH allows you to connect to your Raspberry Pi remotely from another machine and access the command line.

To enable SSH, you need to create a file called ssh (without any extensions) in the boot folder of the microSD card.

1) You can click here to download the ssh file.

2) Move that file to the boot folder of the microSD card.

ssh file microsd card

When the Raspberry Pi starts up, the OS will find the ssh file and will automatically activate SSH.

Now, safely eject the microSD card from your computer and insert it into the Raspberry Pi. Then, power up the Pi using a 5V DC power source.

5) Connecting via SSH to the Raspberry Pi

SSH (which stands for secure shell) is a method of establishing a secure connection with another computer. All data sent via SSH is encrypted. SSH is based on a Unix shell, so it allows you to access your Raspberry Pi files from a remote machine by using terminal commands.

This part is divided into two sections: 

A) Windows

To communicate with the Raspberry Pi via SSH, you need software to handle SSH communication. We’ll use PuTTY. You need to install it on your computer if you haven’t already.

Downloading PuTTY

If you use Windows, you need to download and install a free application called PuTTY. Here’s how to install it:

1) Open your web browser and go to www.putty.org

2) Download PuTTY. We recommend downloading the putty.exe file.

Download PuTTY

3) Run the putty.exe file to execute the software.

putty-exe

Connecting to the Raspberry Pi via SSH

With PuTTY installed, power up your Raspberry Pi and follow the next steps (wait at least five minutes before connecting if this is the first time the Raspberry Pi is booting up to give some time to load the operating system):

1) Open PuTTY.

2) Select/enter the following options:

  • Host Name: raspberrypi *
  • Port: 22
  • Connection type: SSH

* raspberrypi is the default hostname. If you’ve inserted a different hostname in the installation process, you should use that instead.

Connect to Raspberry Pi via SSH

3) Click Open.

4) When you connect to your Raspberry Pi for the first time, you’re prompted by a message warning you that you’re attempting to establish a connection with an unknown host. Simply click No to proceed.

Connect to Raspberry Pi SSH Warning Message

5) Now, you need to login to your Raspberry Pi using the username and password you set on the installation process.

On the new window that opens, type your username and hit Enter.

6) Then, enter your password and hit Enter. You won’t see any characters showing up on the window while you type the password.

Login Raspberry Pi SSH

Now you have an SSH connection established with your Raspberry Pi. This will be useful to install software on your Pi, run your programs, create folders or files, etc…

PuTTY logged in

I recommend reading my Raspberry Pi Cheat Sheet with Basic Linux Commands.

Shutting Down

To shut down your Raspberry Pi, simply type this command on the command line:

pi@raspberry:~ $ sudo poweroff

The SSH connection will be shut down right after.

power off Raspberry Pi Putty

B) Mac OS X/Linux

SSH (which stands for secure shell) is a method of establishing a secure connection with another computer. All data sent via SSH is encrypted.

SSH is based on a Unix shell, so it allows you to access your Raspberry Pi files from a remote machine by using terminal commands. It has grown to be one of the most popular methods for communication between different devices.

Establishing an SSH Communication

In Mac OS X and Linux, you can use the default Terminal window to establish an SSH connection, because SSH comes in all Unix-based OSes. Follow these steps:

1) Boot up your Raspberry Pi.

2) Open a new Terminal window.

3) Type the following command:

$ sudo ssh pi@raspberrypi

or:

$ sudo ssh pi@raspberrypi.local

Note: if you defined a different hostname and username rather than raspberrypi and pi, you should use those instead.

4) Enter your computer password (so you can run a sudo command), and type yes.

5) When you’re asked to type a password for your Raspberry Pi, type the password you’ve set previously, and press Enter/Return.

When you connect your computer to your Raspberry Pi for the first time, you’re prompted by a message warning you that you’re attempting to establish a connection with an unknown host. Simply click OK to proceed

Your Terminal window should look like the Figure below:

logged in

Now you have an SSH communication established with your Raspberry Pi. This will be useful to install software on your Pi, run your programs, create folders or files, etc…

I recommend reading my Raspberry Pi Cheat Sheet with Basic Linux Commands.

Shutting Down

To shut down your Raspberry Pi, simply type this command on the command line:

pi@raspberry:~ $ sudo poweroff

Wrapping up

In this tutorial, you’ve set up your Raspberry Pi to run headless. You’ve installed the Raspberry Pi OS, set up Wi-Fi, and enabled SSH so that you can access the Raspberry Pi command line from another machine on the same network. Finally, you established an SSH connection with the Raspberry Pi.

I hope this guide was useful. You’re now able to easily connect via SSH to your Raspberry Pi and send Linux commands (read Learning Basic Linux Commands – Raspberry Pi Cheat Sheet).

Share your love

🚀 Discover the world of electronics and innovation!

✨ Create, program, and experiment with all your creative ideas with ease.

Spotpear

Leave a Reply

Your email address will not be published. Required fields are marked *

Secure Payments
Securing online payments is a shared responsibility, and everyone can contribute.
Free Shipping
You get unlimited free shipping on eligible items with Ebokify, with no minimum spend.
24/7 Support
Sales gifts are helpful tools often used to show appreciation to clients for their purchase.
Gifts & Sales
Our customer care service is offered in the form of 1st or 2nd level support.