How to change the hostname of your Raspberry Pi via raspi-config in Raspbian Stretch

When you install Raspbian Stretch as the operating system for your Raspberry Pi, the default hostname is raspberrypi.

Since a Raspberry Pi is one of the things that programmers buy, we could deploy several at home.

When you have several Raspberry Pis deployed in your house, you may want them to be identified by hostnames.

So how can we change the hostname of our Raspberry Pi running Raspbian Stretch? This post shows how you can change the hostname of your Raspberry Pi via raspi-config in Raspbian Stretch.

First, open a Terminal window by clicking on the highlighted icon at the top:

Raspbian Stretch 20181113 desktop with a terminal window

Once the terminal window had started, type the following command in the terminal window:

sudo raspi-config

Raspbian Stretch 20181113 terminal window with sudo raspi-config

After raspi-config loads in your terminal, go through the following screens to change the hostname of your Pi in Raspbian Stretch:

Select Network Options in the first menu of raspi-config:
Raspbian Stretch Lite 2018-06-27 raspi-config with Network Options selected

When the Advanced Options menu loads, choose Hostname:
raspi-config on Raspbian Stretch 20181113 with Hostname selected

After you had selected Hostname, raspi-config shows RFC's mandate for hostname labels:
raspi-config on Raspbian Stretch 20181113 showing RFC mandate for hostname labels

After you had selected Ok, you will then see the existing hostname for your Raspberry Pi:
raspi-config on Raspbian Stretch 20181113 showing default Raspberry Pi hostname

Enter a hostname that you desire. For example, if your Raspberry Pi is going to server as a reverse proxy server, you may name it as follows:
raspi-config on Raspbian Stretch 20181113 showing reverse-proxy-server-pi as hostname

After you had entered your desired hostname, choose Finish in the first menu of raspi-config:
Raspbian Stretch 20181113 raspi-config initial screen with Finish selected

When you do so, raspi-config will prompt you to restart your Raspberry Pi:
Raspbian Stretch 20181113 raspi-config Would you like to reboot now

After you choose Yes to reboot your Raspberry Pi, it will take the new hostname that you had given it.

About Clivant

Clivant a.k.a Chai Heng enjoys composing software and building systems to serve people. He owns techcoil.com and hopes that whatever he had written and built so far had benefited people. All views expressed belongs to him and are not representative of the company that he works/worked for.