Hardware Software

How do I install Raspberry Pi OS Lite?

black and blue usb cable

Raspberry Pi computers are incredibly handy for creating home technology projects. You can run your own Minecraft server, store and play media, operate IoT devices or even just manage and filter router traffic. However, to perform these tasks, I suggest you install Raspberry Pi OS Lite.

If you want to use your Pi like a desktop computer, then the standard Raspberry Pi OS (a version of Linux designed specifically for the Pi) is ideal, as it comes with a graphical interface, similar to what you’ll be used to in Windows, Mac, Ubuntu, etc. However, for other projects, many of which are headless (the Pi runs in the background with no screen output), running this version doesn’t make much sense. As well as impacting performance, it makes it more difficult to operate remotely.

The Raspberry Pi OS Lite is just the same, but everything is done via command prompt.

In this article I’ll talk you through how to set a Pi up with the Lite version of the OS, give you various tips on improving performance, and reveal how you can access your Pi remotely.

Get your kit together: hardware requirements

To set up your Raspberry Pi you’re going to need the following:

  • A Raspberry Pi
  • A compatible power supply for the Pi
  • A case (optional)
  • A memory card (8GB or higher, see advice below)
  • An Ethernet cable (optional)
  • A monitor, wired keyboard and wired mouse – these can be removed once the set up is complete
  • A cable to connect the video output of your Raspberry Pi to your monitor
  • Another computer with a card reader so that you can add the Raspberry Pi OS Lite onto your memory card

Choosing your memory card

As well as the RAM memory, you will need a good quality Micro SD card to run the operating system from. I’ll give you some tips later on how to get the most from your card, but even those tips won’t save you if you’re using a sub-standard card.

I would recommend finding a branded card that shows a class of A1 or A2. This means that random I/O speeds have to meet a higher standard, which is critically important when running an OS from them. See Pibenchmarks.com for info on the speeds available from different cards.

I’m using a SanDisk Extreme 64 GB (which has a class of A2). This cost me around £14 from Amazon.

Adding Raspberry Pi OS Lite to your memory card

The first job is to add the OS onto your memory card:

  1. On another computer, download and install the Raspberry Pi Imager
  2. Ensure your Micro SD card is plugged into an appropriate card reader and launch Raspberry Pi Imager
  3. For the “Operating System”, select “Raspberry PI OS Lite”
Raspberry Pi Imager
  1. For the “Storage”, select your Micro SD card
  2. Click on the “WRITE” button
  3. The OS will now be downloaded and added to your memory card

Setting up your Raspberry Pi

At this point you’ll need to connect up your Raspberry Pi – not just add a power supply, but also a keyboard, mouse and monitor. Oh, and pop in the memory card that we set up in the previous step. If you can, it will be best to connect your Ethernet cable at this stage too, or else we’ll need to set this up on Wi-Fi.

Power on your Pi and it should go through a boot-up sequence before settling on a login prompt. The default details are:

Login: pi
Password: raspberry

We will now need to set up the OS with a few basic settings. Type the following, followed by the Enter key:

sudo raspi-config

A text menu will appear, which you can navigate using the cursor keys on the keyboard, as well as the Enter key to select options and Escape to move back.

Raspberry Pi config menu

Here are the options that you need to set…

  1. Change your default login password (1 System Options > S3 Password)
  2. Set a hostname (1 System Options > S4 Hostname) – this is name that you want to give your server

The next three options are related to localisation. If you’re outside of the UK, you’ll need to set this to something appropriate for your location.

  1. Set your timezone (5 Localisation Options > L2 Timezone > Europe > London)
  2. Finally, if using Wi-Fi, set the WLAN Country (5 Localisation Options > L4 WLAN Country) to GB Britain (UK)
  3. If you try and exit out out of the Configuration Tool, it should prompt you to reboot. If it doesn’t, when back at the command prompt, type sudo reboot and press Enter
  4. Once restarted, log back in and run sudo raspi-config again
  5. If you’re using Wi-Fi (if only initially), you will need to define the SSID and password (1 System Options > S1 Wireless LAN > Enter SSID & Password)

The next two commands are performance enhancements:

  1. The Expand Filesystem option (6 Advanced Options > A1 Expand Filesystem) will expand your partition to the maximum size of your SD card so you can actually use all your space
  2. Memory split (4 Performance Options > P2 GPU Memory) allows you to define how much of the Pi’s memory is allocated to graphics. If you’re running your Pi headless (i.e. no graphical output) then put this to the minimum of 16 (MB)
  3. Exit out and you’ll probably be prompted to reboot again. Sign back in

Remote access – get your IP address

If you want to access your Pi from another computer, we’re going to need to know its IP address. To do this, type the following:

ifconfig

This outputs the information for each network connection (eth0 for ethernet and wlan0 for Wi-Fi), which includes the IP address. Depending on which connection you’re using you can grab the IP address.

However, this may change.

IP addresses are allocated to identify an internet connected device – a unique one is assigned to your router when it connects to your ISP. Then, all devices connected to your router are given one from a range which are reserved for this use. So a device in one household may have the same internal IP address as the same device in another.

The big problem here is that over time that internal IP address may change. Most routers have an option to fix an IP address to a specific device, so whatever happens it will always have the same internal IP. What I can’t do here, though, is tell you how to do this as it will be different for each router. You’ll need to go and investigate this for yourself. If you don’t do this then you may find you have to occasionally revisit the above instructions to grab the new allocated IP.

Setting up SSH

Now, we need to set up SSH so that we can access the Pi remotely (and ditch the keyboard, mouse and monitor currently attached to your Pi). To do this, run the following 2 commands, followed by Enter after each line:

sudo update-rc.d ssh defaults
sudo update-rc.d ssh enable

Reboot the Pi again.

You should now be able to access it remotely using SSH. Depending on what you’re using – Linux/Mac or Windows, the method is different.

Following the instructions below, on another computer, to remotely access your Pi. Once you’ve done this successfully, you can remove the monitor, keyboard and mouse, as they are no longer required. From now on, it just needs power and (optionally) Ethernet, which means it can be tucked out of sight.

Mac & Linux

Open up Terminal and type the following:

ssh pi@x.x.x.x

Where you replace x.x.x.x with the IP address that you got above. It will prompt for your password.

Windows

Windows doesn’t have SSH capabilities built in and your best is to use something such as the free, open-source software PuTTY. Download and install the software. When run you should be presented with a screen like this:

PuTTY software

Type your IP address into the Host Name field and then click the “Open” button. You will be prompted for the username and password.

Overclock the memory card

You read that correctly, we’re going to overclock the SD port from 50Hz to 100Hz, which is safe for all modern, good quality, Class 10 cards.

SSH onto your Pi. This overclock option is in the file /boot/config.txt. Before we do anything, we therefore want to back this file up with the following command:

sudo cp /boot/config.txt /boot/config.txt.backup

Now, we need to make the change that will overclock the SD card slot:

sudo nano /boot/config.txt

This takes you into a simple text editor. Scroll down, preferably to the end and cut/paste in these two lines:

# Overclock the SD card port to 100Hz
dtparam=sd_overclock=100

Press Ctrl+X to exit and then confirm that you want to save the changed file. Reboot again (sudo reboot) to activate the change.

If anything goes wrong and your Pi won’t boot, you can put the SD card into another computer, open /boot/config.txt and change it back to the original. 

Next, we want to update JavaJDK as the version that comes with the OS isn’t very up to date. Rather than repeat the lengthy instructions from elsewhere, head to this excellent article which explains the process.

Switching off Wi-Fi

If you used Wi-Fi initially but then switched to Ethernet, you’ll find the OS will connect to both (although it will use the Ethernet connection). If you want to turn this off, then you can do it in the following way:

Open the config.txt file with the Nano editor:

sudo nano /boot/config.txt

Now find the following line:

# Additional overlays and parameters are documented /boot/overlays/README

And add this line underneath it:

dtoverlay=disable-wifi

You can also add the following to disable Bluetooth, if you wish:

dtoverlay=disable-bt

Press CTRL & X to exit – you will be prompted if you wish to save the changes you’ve made. Reboot the Pi to activate the change.

Update everything else

Finally, we want to make sure everything is updated, particularly after all of the above changes. Run the following:

sudo apt-get update && sudo apt-get upgrade

And that’s it.

Add your own project

Now you can add whichever project you wish. You’ll need to consult the appropriate instructions on how to do this but here are a few you may want to consider:

  • Homebridge – integrate with smart home devices that do not natively support HomeKit
  • Home Assistant – a central control system for smart home devices
  • Pi-hole – network-wide ad blocking
  • RasPlex – a Plex home media client
  • RetroPi – retro game emulation

Alternatively, when you used Raspberry Pi Imager, you may find the projects above among the options. Imager will then add the OS along with the appropriate project code.

About the author

David Artiss

Currently working for a technology company based in San Francisco, David has worked in IT for nearly 30 years. He is a keen gamer and happily admits to being a gadget nerd too.

Add Comment

Click here to post a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Advert

Advert

Advert

%d bloggers like this: