How to Change Hostname in Linux Permanently

Опубликовано: 17 Июнь 2022
на канале: CentLinux
349
6

Learn how to change the hostname in Linux permanently with this simple guide. Modify and set a new hostname for your Linux system that persists across reboots.

Changing the hostname in Linux permanently involves modifying both the system's current hostname and ensuring it persists after a reboot. The hostname is the unique identifier for your system on a network, and updating it is a common task when configuring servers or personal machines.

First, to change the hostname temporarily, you can use the `hostname` command, but this change will not survive a reboot. To make the change permanent, you need to modify specific system files. One of the key files is `/etc/hostname`, where you can update the hostname to your desired value. You may also need to edit the `/etc/hosts` file to associate the new hostname with the system's loopback address (127.0.0.1) for proper name resolution.

After making these changes, restart the system or use the appropriate command to reload the hostname settings. The new hostname will then be applied permanently, persisting across reboots and accurately reflecting the system's identity on the network.

#centlinux #linux #networking

Subscribe us for more Linux Tips & Tutorials, it is free:

Youtube:    / @centlinux  
Website: https://centlinux.com
FaceBook:   / centlinux1  
Twitter:   / centlinux