[RESOLVED] How do I change Hostname (computer name) in Linux Ubuntu?« Back to Questions List

I tried to change the hostname, hosts configuration files through the change, but nothing changed after the reboot.
Posted by Dmytro Yakovenko
Asked on June 4, 2022 4:31 am
0
The procedure to change the computer name on Ubuntu Linux:
  1. Edit /etc/cloud/cloud.cfg and set "preserve_hostname" parameter from false to true.
  2. Type the following command to edit /etc/hostname using nano or vi text editor: sudo nano /etc/hostname Delete the old name and setup new name.
  3. Next Edit the /etc/hosts file: sudo nano /etc/hosts Replace any occurrence of the existing computer name with your new one.
  4. Reboot the system to changes take effect: sudo reboot
Posted by darkfire
Answered On June 4, 2022 4:32 am