How to Change Hostname of Fedora Linux
Posted on In Linux, NetworkDifferent 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
HOSTNAME#
Assign the hostname for this computer to this variable. For example, to set the hostname to ericpc.systutorials.com, just set
HOSTNAME=ericpc.systutorials.com
Save the file and it should take effect. If the machine uses the network service, restarting the network may be needed:
# service network restart
Alternative way is to set the hostname in `/etc/hostname`.
Note that this is for newer version of Fedora, e.g., Fedora 20.
You can also use `hostnamectl set-hostname your_host_name` to change the hostname on newer Linux systems.