In this guide I’ll show you how to install the Raspbian Lite operating system (OS) on your Raspberry Pi. Raspbian Lite is meant to be used for “headless” servers, which means this setup won’t have a display and keyboard attached to the Raspberry Pi itself, we’ll be using our computer to connect to the Raspberry Pi via the local network.
The guide is written for the Raspberry Pi 1B+, Raspberry Pi 2 and Raspberry Pi 3 which all have an Ethernet port, allowing the Raspberry Pi to be connected to the wired network using an Ethernet cable.
The Raspberry Pi 3 has built-in WiFi, on how to set that up, I’ll talk later in a different post, here.
When Raspbian was updated to the newest Debian release called “Jessie” (Autumn 2015), they released Raspbian Jessie Lite, a Raspbian version which does not have a GUI (Graphical User Interface), so uncompressed image file size fits a 2GB microSD card. Since this version is meant to work in command line only, it has SSH server enabled by default, so we don’t need to attach a display/keyboard to the Pi. We write the image to the microSD card, pop to card into the PI, give power to the Pi, and connect to it via your favourite SSH client.
Raspberry Pi 2B 8GB microSDHC card Power Supply USB Keyboard Wired ethernet connection
First you need to write the Raspbian Lite image, 2016-05-10-raspbian-jessie-lite to an SD card (the Lite version doesn’t have a graphical interface, just command line, so it will fit on an 1GB microSD card just fine).
1. After booting it up log in to the Pi via SSH
2. Update everything before starting installations
sudo apt-get update sudo apt-get upgrade sudo reboot
Then go through the raspi-config
Focus on these settings:
Change User Password
Advanced Options> A2 Hostname
Advanced Options> A3 Memory Split > 16
A reboot is needed after this.
3. Install your favourite packages
sudo apt-get install vim sudo apt-get install htop
If you would have issues with unset locales, which pops up errors when installing anything with apt-get, you can set them now manually:
$ export LANGUAGE=en_GB.UTF-8
$ export LANG=en_GB.UTF-8
$ export LC_ALL=en_GB.UTF-8
$ sudo locale-gen en_GB.UTF-8
$ sudo dpkg-reconfigure locales
Check if every locale is successfully set to en_GB.UTF-8 with
Time for adding my SSH key for passwordless logins. Create the authorized keys file and set permissions.
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
$ touch ~/.ssh/authorized_keys
$ chmod 600 ~/.ssh/authorized_keys
Adding my actual SSH public key:
$ echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbRZwJtqrULP1cHizv050CB6lLw1XQGPaojV8IIKdcsBNlGFMQ35MNeFweU62XzgaPz6z6YUBXM7LMEZwbfJIa+9gJxueB4UMgFZv2uU5uByDg90iVWPd4sU6zawsfC8tkpIWsIAKtFFC5oFd+acqRKRVctrYRFJdQfN+Sm6qP4oOvWy6HV5XI9+wqhr7fxDLzNG9E2fN/cbaKZlrmj7uVpaoN34QLXy3c/sKHNV1hDg2e7ioxYZgts7BANy60NqHu4YcSsEcehZxzyZiYTiP/sp7BuAreqGo2HiHNVTy+UXfjLKbU6uy2yXifu26hNLSpaE8RyhZ3DipzfDiVnwt/ firstname.lastname@example.org" >> ~/.ssh/authorized_keys