To change the hostname on Ubuntu 24.10, follow these steps to update it across your system properly.
Step 1 : Check the current hostname
First, check the current hostname by running the following command:
This will display the current hostname of your system.
Step 2 : Change the hostname
To set a new hostname, use the hostnamectl
command. Replace "server-01" with your desired hostname:
Step 3 : Verify the new hostname
After setting the new hostname, confirm that it has been updated:
You should see the new hostname listed.
Step 4 : Update the /etc/hosts
file
Next, open the /etc/hosts
file to update the hostname entry:
Look for any lines with the old hostname and replace it with the new one (e.g., "server-01").
Step 5 : Reboot the system
To apply the changes fully, reboot your system:
Congratulations! You've successfully changed the hostname on your Ubuntu 24.10 system.