In this short article we will learn how to change hostname on OpenSuse operating system.
Introduction
The hostname is a crucial aspect of a computer’s identity on a network. In the openSUSE operating system, managing the hostname is essential for proper communication and identification. This article will explore the significance of hostnames, how to check the current hostname, and the steps to change it in OpenSUSE.
A hostname is a label assigned to a device on a network. It helps in identifying and accessing the device among other networked systems. The hostname is associated with the device’s IP address, facilitating communication between machines.
How To Change Hostname on OpenSuse
Checking the Current Hostname
Before making any changes, it’s essential to check the current hostname. Open a terminal and enter the following command :
$ hostname
or we also type the following command :
$ hostnamectl
Output will be as shown below :
ramansah@bckinfo:~> hostname localhost
ramansah@bckinfo:~> hostnamectl Static hostname: localhost Icon name: computer-vm Chassis: vm ๐ด Machine ID: 01a21647ba5544a9b9fddb762c142762 Boot ID: 60b1085a26b74229a638d577f3c42ff8 Virtualization: vmware Operating System: openSUSE Tumbleweed CPE OS Name: cpe:2.3:o:opensuse:tumbleweed:20240201:*:*:*:*:*:*:* Kernel: Linux 6.7.2-1-default Architecture: x86-64 Hardware Vendor: VMware, Inc. Hardware Model: VMware Virtual Platform Firmware Version: 6.00 Firmware Date: Thu 2020-11-12 Firmware Age: 3y 2month 4w
Changing the Hostname
To change the hostname in openSUSE, follow these steps. In this example we will change hostname to bckinfo
.
1. Update the /etc/hosts file :
In this example, we will comment the line for :
#127.0.0.1 localhost localhost.localdomain
and create a new line for
127.0.0.1 bckinfo
$ sudo vi /etc/hosts
# IP-Address Full-Qualified-Hostname Short-Hostname
#
#127.0.0.1 localhost localhost.localdomain
#::1 localhost localhost.localdomain ipv6-localhost ipv6-loopback
127.0.0.1 bckinfo
2. Update the /etc/hostsname file :
$ sudo vi /etc/hostname bckinfo
3. Reboot the system :
$ sudo reboot
4. Verify the hostname :
The last step is to confirm, if the hostname was changed. For this purpose we will use the command line as we use on first step.
$ hostname
or
$hostnamectl
ramansah@bckinfo:~> hostname bckinfo ramansah@bckinfo:~> hostnamectl Static hostname: bckinfo Icon name: computer-vm Chassis: vm ๐ด Machine ID: 01a21647ba5544a9b9fddb762c142762 Boot ID: 60b1085a26b74229a638d577f3c42ff8 Virtualization: vmware Operating System: openSUSE Tumbleweed CPE OS Name: cpe:2.3:o:opensuse:tumbleweed:20240201:*:*:*:*:*:*:* Kernel: Linux 6.7.2-1-default Architecture: x86-64 Hardware Vendor: VMware, Inc. Hardware Model: VMware Virtual Platform Firmware Version: 6.00 Firmware Date: Thu 2020-11-12 Firmware Age: 3y 2month 4w
Conclusion
Managing the hostname in openSUSE is a straightforward process that involves editing configuration files and restarting the network service. By understanding the significance of hostnames and following these steps, users can easily customize their system’s identity on the network. Whether it’s for organizational purposes or personal preference, changing the hostname in openSUSE is an accessible task that enhances the overall user experience in a networked environment.