It may be necessary to edit the DNS name of a Linux virtual machine. This can be accomplished following these steps:
- View the current hostname of the virtual machine: SSH into the machine and execute the command hostnamectl status.
- Execute the command hostnamectl set-hostname <NAME> to set the system hostname.
- Restart the VM to allow the modifications to take effect.
If any issues are encounted using the above commands, an alternative technique is to manually edit the file /etc/hostname
to update the hostname.