Changing Hostname of Fedora Linux

Different Linux distros have different method to set the hostname. On Fedora Linux, it is quite simple.

On newer Fedora releases

At least from Fedora 19 (sorry, no sure the exact earliest version):

You need to edit the file /etc/hostname which just contains the hostname.

On older Fedora releases

Sorry, I do not know the exact version till which you need to use the above method. At least from Fedora 12 to Fedora 17, you need to use this method.

On Fedora, you need to use this method.

Open the /etc/sysconfig/network file

# vim /etc/sysconfig/network

Find the line starting with


Assign the hostname for this computer to this variable. For example, to set the hostname to, just set

Save the file and it should take effect. If the machine uses the network service, restarting the network may be needed:

# service network restart

Eric Z Ma

Eric is a father and systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.


Leave a Reply

Your email address will not be published. Required fields are marked *