To change the hostname on CentOS Stream 10, follow these simple steps:
Step 1 : Run the following command to display the current hostname:
Step 2 : Use the hostnamectl
command to set a new hostname. For example:
Step 3 : To ensure the hostname has been updated, check the contents of the /etc/hostname
file:
Step 4 : Open the /etc/hosts
file with a text editor:
Replace the old hostname with the new one where applicable, then save and exit.
Step 5 : Restart your system to apply all changes:
Congratulations! You have successfully set or changed the hostname on your CentOS Stream 10 system.