ES | EN | IT

Raspberry PI Initial Installation and Preparation

This tutorial covers the initial installation and preparation of a Raspberry PI.

 

MATERIALS LIST:

 

First we will create the memory as usual, install it in our Raspberry and turn it on. We will configure the necessary parameters, such as network, enable ssh access, update all packages to ensure we have the latest version running.

 

LOCALE CONFIGURATION

We will configure the locales, for this we will use the dpkg-reconfigure locales command, selecting only en_US:UTF-8. When we return to the system prompt, edit the /etc/default/locale file, and leave only the following entries:
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=en_US.UTF-8

 

DISABLE IPv6 SERVICES

Many times we do not need to have IPv6 services active, so it is better to disable them. To do this we must edit the /etc/sysctl.conf file, adding the following entries:
###################################################################
# Disable IPv6 services
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1

Then reload the services with sysctl -p

 

PACKAGE CLEANUP

To keep the operating system running more smoothly and securely, we must keep the system up to date and remove unused packages. A good tool is called deborphan which we can install using apt -y install deborphan.

First we perform a complete system update:
apt -y update ; apt -y upgrade
Then we can restart the device and proceed with the cleanup part.

Now we will use the output of deborphan to clean up installed packages that are not used:
deborphan | xargs apt -y remove

Then we will clean up the phantom packages, which were removed and left some traces in the system. For this we will use a series of concatenated commands:
dpkg --list |grep "^rc" | cut -d " " -f3 | xargs dpkg --purge

Finally, we will use apt to remove other packages that are not in use:
apt autoremove

FIXING APT KEY ERRORS

In some cases we will have an error about expired keys when using APT. The solution is quite simple: