Pi 4 What is wrong with this sentence

Raspberry Pi OS: basic configuration on the command line

After the first commissioning of a Raspberry Pi with a Raspberry Pi OS in the Lite version, i.e. without a desktop, you should make a basic configuration before you start with possible installations and configurations.
This includes the configuration of language, character set, time zone and a German keyboard layout. You should also change the standard password of the user "pi" and update the software of the system. Then the basic configuration of the Raspberry Pi OS is already done. In addition, further configuration steps may be required depending on the application.

Note: A different approach is recommended for the basic configuration with Raspberry Pi OS in the desktop version.

Basic configuration: step by step on the command line

The following steps are a rough guide for the basic configuration. Depending on the application and requirements, additional or different configuration steps may result.

  1. change language
  2. Change keyboard layout
  3. Change time zone
  4. Change WLAN country code
  5. Change the default password
  6. Change host name (optional)
  7. Activate SSH and recreate the SSH key (optional)
  8. Set screen resolution (optional)
  9. Extend the file system (optional)
  10. Update software
  11. Change the designation of the network interfaces (optional)

Note: Almost all configuration changes only take effect after a restart. But you can make almost all changes together and then apply all changes together with a restart.

Special feature: configuration on the command line via SSH

If the configuration is carried out remotely via SSH, i.e. not locally on the Raspberry Pi with a keyboard, then there are a few restrictions to be observed. If you configure something that is directly connected to the Raspberry Pi, such as a keyboard and screen, this may produce error messages. Because when operating remotely, these devices do not exist for this user from the point of view of the system. For example with the keyboard layout. The user logged in remotely does not have a keyboard on the Raspberry Pi. So you can't configure them either. That goes for other things as well. That's not a problem when you take that into account.

User registration / login

When you log in for the first time, you use ** pi ** as your username and ** raspberry ** as your password. At the first start-up, however, "no" German, but an English keyboard layout is set. This means that the Y and Z keys are swapped. The password in this case is ** raspberrz **.

Note: You don't have this problem when logging in via SSH.

start configuration

IMAGE: raspi-config

For the configuration, Raspberry Pi OS comes with the command line tool "Raspberry Pi Software Configuration Tool", with which the important things can be configured quickly without having to enter complicated commands on the command line.

sudo raspi-config

Brief instructions on keyboard control

  • Arrow keys up and down: With the arrow keys you can jump up and down in the menu or in a list.
  • ESC: With ESC you jump back in the menu or cancel a configuration.
  • Enter / Return: With Return you select an option in the menu or press the control fields at the bottom.
  • Spacebar: The spacebar is used to select or deselect an option in a list.
  • TAB: With TAB you can switch to the control fields at the bottom to save, cancel or exit changes. Depending on what is on offer.

1. Change language (Locale)

Anyone who speaks English can ignore this attitude. As a rule, however, it is preferred to display and display in German.

Localization Options / Locale

Here you can select the following setting, for example:

Locales: de_DE.UTF-8 UTF-8

2.Change keyboard layout (keyboard)

As a rule, all images have an English language setting and an English keyboard layout. An English assignment is set by default, in which, for example, Y and Z are swapped. With a German keyboard you would then have to press the Z for a Y and vice versa. In order to avoid these and other confusions, it is advisable to choose the keyboard layout as the keys are printed on.

Localization options / keyboard

For example, the following setting is selected here:

Keyboard: Generic PC-Keyboard with 105 Keys (Intl) Variant: German / Deutsch

There are many different choices. You should choose the variant that probably fits the connected keyboard.

Then you will be asked about the function of special keys. It depends on what you need or want. If you don't know, then you should simply accept the default settings and change the configuration later if necessary.

3. Change the time zone

The time zone is used to set the time at your own location. The default setting can be wrong. Therefore you have to correctly choose the time zone in which you are located and whose time you want to be displayed.

Localization Options / Timezone

Here you can select the following setting, for example:

Area: Europe Location: Berlin

4. Change the WLAN country code

The WLAN country code is used to select a type of profile for the use of the frequency spectrum in which WLANs are operated. Almost every country has different requirements for this, which are also linked to the operating license. The locally valid country profile must be set so that the WLAN device works within the permissible range.

Localization Options / WLAN Country

Here you can select the following setting, for example:

Country: DE Germany

Note: If the country code remains at the standard value "GB", the integrated or external WLAN adapter may not recognize any WLANs in Germany.

5. Change the standard password

Every standard installation of Raspberry Pi OS has the standard user “pi” with the standard password “raspberry”. If you operate a Raspberry Pi in the network with the SSH server switched on, the first official act after the language and country settings should be to change the standard password.

System Options / Password

Note: If you leave the password on "raspberry" after the initial start-up of a Raspberry Pi, then strangers can also access the Raspberry Pi. And this both locally via screen and keyboard, as well as via SSH over the network.

6. Change host name (optional)

The host name defines the computer name under which the Raspberry Pi can be reached in the network. By default this is the host name "raspberrypi". Perhaps one would like to change that. For example, if you operate several in the same network. Then you might want to be able to distinguish them by name.

System Options / Hostname

The default host name can be changed in the text field. It is saved with a click on "OK", but only adopted when you restart.

Note: It is important that if you have changed the host name that you also recreate the SSH key. Otherwise, a new connection via SSH may fail.

7. Activate SSH and recreate the SSH key (optional)

SSH is the abbreviation for Secure Shell. This is a communication protocol and client-server software for operating a Linux operating system remotely via the command line. "Secure" indicates that the connection is secure. This means that the remote stations, client and server, authenticate each other. The connection is then encrypted.
For authentication, the SSH server on the Raspberry Pi has a key, a digital code with which the SSH server authenticates itself to the SSH client. The user of the SSH client authenticates himself with the username and password valid on the Raspberry Pi.

The problem with the key of the SSH server is that it is identical on all the same images. However, a key should be unique, otherwise it is not suitable for secure authentication. Therefore you should change this with the first basic configuration. We have to do this directly on the command line without "raspi-config".

First we delete all the files that the keys are in. There are several of them.

sudo rm / etc / ssh / ssh_host_ *

Then we reconfigure the SSH server. The new key files are created automatically.

sudo dpkg-reconfigure openssh-server

The SSH server is deactivated or switched off in the Raspberry Pi OS by default. You can activate it via "raspi-config" or activate and start it directly on the command line.

Start (activate) SSH server automatically:

sudo systemctl enable ssh

Start the SSH server:

sudo systemctl start ssh

Note: The connection may no longer be established when you log in again via SSH. This is because a different identity was saved locally on the SSH client for the Raspberry Pi (you agreed to this with Yes or Yes). This identity must be deleted on the local SSH client and the new identity confirmed.

8.Setting the screen resolution (optional)

The Raspberry Pi and a connected screen usually automatically agree on the correct resolution when the Raspberry Pi is started. This is typically the native resolution of the screen, but it only works if the screen in front of the Raspberry Pi was switched on.

It can sometimes be useful to change the automatically determined resolution. In "raspi-config" you can find the resolution setting in "Display Options / Resolution".

9. Extend the file system (optional)

When a Linux distribution is written to a memory card, the root partition does not occupy the entire memory card, but leaves part of it unused.
When Raspberry Pi OS is started for the first time, the file system is automatically expanded to the total size of the memory card.
But if you write a preconfigured image on a new, larger memory card, you have to expand the file system manually.

Advanced Options / Expand Filesystem

A restart is then mandatory.

10. Update software

It is particularly important during the initial start-up and basic configuration that the software of the system is brought up to date. Updating all installed applications and libraries consists of two steps on the command line.

sudo apt-get update sudo apt-get upgrade

Depending on the application and requirements, one should be careful when updating the system. With the update you can destroy a system that has been configured with a lot of effort.

Important: restart Raspberry Pi

After making extensive changes to the configuration, you should always restart the Raspberry Pi.

sudo reboot

You can only use the system for experiments and further configuration when the system has accepted the changes and then runs without any problems.

Extension: network configuration

Extension: Tips and tricks on the command line

Extension: remote maintenance and remote service

Other related topics:

Everything you need to know about computer technology.

Computer technology primer

The Computertechnik-Primer is a book about the basics of computer science, processors, memories, interfaces and other hardware components.

I want that!