This tutorial shows you how to change the hostname Debian on 10 Buster without rebooting the system.
The host name is set when you install the Debian operating system, or if you are starting a virtual machine, when you start it will dynamically assigned to the instance.
prerequisites
Log in as a user to be able to change the system hostname, you need to have sudo privileges of the root user or.
Displays the current hostname
And in all other Linux distributions Debian 10, you can change the use systemd in hostnamectl tool and displays the name given to the host system.
To view the current system host name, type hostnamectl without any options:
hostnamectl
The system displays the current output of the host name, in this example host.buzheng.org.
Change the system host name
The host name is an identification label on the computer network. Set on the same host name, you should not on the same network two different computers. We recommend using a fully qualified domain name (FQDN) as the system host name.
It involves two steps when you change the system hostname on Debian 10. First, the required use hostnamectl set-hostname command followed by the host name to new host name, then use the new hostname update the file / etc / hosts.
For example, to change the name of the host system arya.example.com, you will perform the following steps:
01.
First, run the following command to set the new host name:
sudo hostnamectl set-hostname arya.example.com
This command does not generate an output hostnamectl. On success, it returns 0, otherwise it returns a nonzero error code.
02.
Second, open the / etc / hosts file and replace the old host name with the new host name.
/ Etc / hosts file
127.0.0.1 localhost
127.0.0.1 arya.example.com arya
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Verify changes
To verify that the host name has been changed successfully, use the following command again hostnamectl:
hostnamectl
The new system host name will be printed on the command line.
Output Static hostname: arya.example.com
Icon name: computer-vm
Chassis: vm
Machine ID: 70a3f06298014fd9ac42e5dc1de1034a
Boot ID: 1dc8b9af89a4426b99cb348f6d483757
Virtualization: oracle
Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 4.19.0-5-amd64
Architecture: x86-64
in conclusion
Change the system host name on Debian 10 Buster is a simple task, requires only two simple steps.