Ubuntu How to Change Hostname?
Contents Start a New Terminal to See the New Hostname. for Ubuntu Server Without a Gui, Run Sudo Vi /Etc/Hostname and Sudo Vi /Etc/Hosts and Edit Them One by...
Contents
Start a new terminal to see the new hostname.
For Ubuntu server without a GUI, run sudo vi /etc/hostname and sudo vi /etc/hosts and edit them one by one.
In both files, change the name to what you want and save them.
Finally, restart your computer to apply the changes.
How can I change hostname in Ubuntu 18.04 permanently?
Ubuntu 18.04 LTS change hostname permanently
- Type the hostnamectl command : sudo hostnamectl set-hostname newNameHere. Delete the old name and setup new name.
- Next Edit the /etc/hosts file: sudo nano /etc/hosts. Replace any occurrence of the existing computer name with your new one.
- Reboot the system to changes take effect: sudo reboot.
How can I permanently change my hostname in Linux?
Change a server’s hostname
- Using a text editor, open the server’s /etc/sysconfig/network file.
- Modify the HOSTNAME= value to match your FQDN hostname, as shown in the following example: HOSTNAME=myserver.domain.com.
- Open the file at /etc/hosts.
- Run the hostname command.