How to Set or Change Hostname on Fedora 40

To change hostname on Fedora 40, follow the steps below:

Step 1 : First, check the current hostname using the command:

Step 2 : Next, set the new hostname using the following command (replace "server-01" with your desired hostname):

Step 3 : Verify the hostname change by checking the contents of the hostname file:

Step 4 : Open the /etc/hosts file to update the hostname:

- Find the line with the old hostname and replace it with the new one.

Save and exit the file.

Step 5 : Reboot your system for the changes to take effect:

You have successfully set or changed the hostname on Fedora 40.