Random Nerd Tutorials
Shares

Installing Raspbian Lite, Enabling and Connecting with SSH

Shares

In this post, I’ll show you how to download and prepare your Raspberry Pi with the latest version of the Raspbian Lite Operating System (OS) and how to establish an SSH communication.

Raspberry Pi and microSD card

The Raspberry Pi is a computer and like any other computer it needs an OS installed.

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

If you go to the Raspberry Pi website and you open the downloads section: https://www.raspberrypi.org/downloads.

You’ll find all the official Operating Systems that you can download. I recommend using Raspbian, because it is the most supported OS by the Raspberry Pi community.

Throughout this example we’re going to use Raspbian Lite.

Why Raspbian Lite?

Because it is a lightweight version of the Raspbian and it doesn’t have a graphical user interface installed. This means that it doesn’t have any unnecessary software installed that we don’t need for most projects, so this makes it the perfect solution for future home automation projects.

Click the Download ZIP button to download the Raspbian Lite Operating System.

Flashing Raspbian Lite in your microSD card

After downloading the Raspbian Lite OS, you should have a .zip file in your Downloads folder. We’ll be using a software called Etcher to flash the image to your SD card. You can download Etcher here and it is very easy to install in all operating systems.

Open the Etcher software and connect your microSD card to your computer:

1) Select your .zip folder with the Raspbian Lite OS

2) Select your microSD card as the drive

Important: this process erases and overwrites the selected device. Be certain that you’ve selected the microSD card, and be certain that you have copies of any files that you need from the card. I can’t stress this enough: Be certain that the microSD card is the device you chose!

3) Press the Flash! button to start writing the image to the microSD card. This process takes between 10 and 20 minutes, depending on your microSD card class number and your SD card writer’s transfer speed

Enabling SSH

After the flash process is completed, open your microSD card and you should see something similar to the image below:

You must enable SSH communication, so that you can establish a communication with your Pi.

To do that, go to this link https://drive.google.com/open?id=0B_BzxRImIcd-SWE2NVNPT1FycFE and download a blank file called ssh by click the Download button.

You should have the ssh file (that has no extension) in your Downloads folder.

Move the ssh file to the microSD card as shown below:

Removing your microSD card

Raspbian Lite was successfully flashed into your microSD card and you can now remove your microSD card!

After installing Raspbian Lite in your microSD, it is time to boot up your RPi for the first time. Follow these instructions:

1) Insert your microSD card in your Raspberry Pi

2) Connect an Ethernet cable from your Raspberry Pi to your router to ensure you have an internet connection

3) Connect your 5V DC power adapter to power your Pi

Searching for your Pi on your network

After booting up your Raspberry Pi, you need to find its IP Address. In order to find your RPi in your network, you need to install a software that scans your network for devices.

I’ll use a software called Angry IP Scanner. It runs on Windows, Mac OS X or Linux.

Downloading Angry IP Scanner

Go to the downloads section of the Angry IP Scanner software: http://angryip.org/download.

Select the right installation file for your computer. In my case, I’m using 64-bit Windows PC.

Note: make sure you have Java installed.

Running Angry IP Scanner

Now, run the Angry IP Scanner. When you launch the software, it should automatically pick the IP Range for you network, so all you need to do is press Start and wait a few seconds.

Angry IP Scanner found my Raspberry Pi on the local network with its default Hostname of “raspberrypi.local“.

Save your IP address (in my case is 192.168.1.98), because you’ll need it later in this post.

Important: your Raspberry Pi may have a different IP address depending on whether it’s connected to your router through Wi-Fi or Ethernet, and that address might even change from time to time. If you ever find yourself unable to connect via SSH, you can always double-check the IP address using the Angry IP software!

You can watch this video to see Angry IP Scanner in action.


Connecting via SSH to your RPi

This part is divided into two sections: one for A) Windows and the other for B) Mac OS X/Linux.

Choose a title below to read the instructions for the Operating System that you have installed in your computer:

A) Read Windows version

SSH (which stands for secure shell) is a method of establishing a communication with another computer securely. 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.

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

2) Go to www.putty.org

3) Click the putty.exe file to download it

4) Run the putty.exe file to install the software

Opening PuTTY

With PuTTY installed, power up your Raspberry Pi and follow these steps:

1) Open PuTTY

2) In the PuTTY Configuration dialog box, select SSH as your connection type

3) Type your IP address from the previous Unit, in my case is 192.168.1.98 as the host. The port needs to remain at the default number, which is 22

The dialog box should have the settings shown in the Figure below:

4) Click Open

5) When you’re asked to log in, type pi and press Enter

6) When you’re asked to type a password, type raspberry

Note: default settings for Raspbian Lite OS are: username = pi and password = raspberry

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.

Now you have an SSH communication established with your Raspberry Pi. This will be useful to install software in 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

You see the following information after you use the shutdown command:

B) Read Mac OS X/Linux version

SSH (which stands for secure shell) is a method of establishing a communication with another computer securely. 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 communication, 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@ip_address

Make sure you replace the ip_address part with the real IP address of your Raspberry Pi that you found in the previous Unit. In my case, I’ll run the following command:

$ sudo ssh pi@192.168.1.98

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 raspberry, press Enter/Return.

Your Terminal window should look like the Figure below:

Note: default settings for Raspbian Lite OS are: username = pi and password = raspberry

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.

Now you have an SSH communication established with your Raspberry Pi. This will be useful to install software in 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

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).

Like home automation? Learn more about Node-RED, Raspberry Pi, ESP8266 and Arduino with my course: Build a Home Automation System for $100.

Do you have any questions? Leave a comment down below!

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.

Recommended Resources

Home Automation using ESP8266 »
Build IoT projects and home automation gadgets with the ESP8266 Wi-Fi module.

Build a Home Automation System »
Learn how to build a automation system using open-source hardware and software from scratch.

Arduino Step-by-Step Projects »
Build 25 cool Arduino projects with our couse even with no prior experience!

Leave a Comment:

⏰ Early Black Friday 2017 Special ⏰
Download all our courses up to 35% off