Permanently Change Hostname on Fedora

Computer Windows Linux Project Configuration

 

Change Fedora Hostname.

 

   On the installation process of Fedora, you named you Fedora machine.  Then one Monday morning you decide to change the hostname to something else.  The step by step procedure below show the simples way to change hostname on Fedora machine.

 

1.  Display your fedora box hostname by execute the hostname command.

[root@localhost ~]# hostname

localhost.localdomain

[root@localhost ~]# 

 

2.  To change Fedora hostname execute the hostname command as example below.

[root@localhost ~]# hostname fedora.labtestproject.com

[root@localhost ~]#

 

3.  Hostname command explanation:

change hostname command

 

Execute hostname command again to verify the changes.

[root@localhost ~]# hostname

fedora.labtestproject.com

[root@localhost ~]#

 

Please note: That with the hostname command, the hostname only for the session only... the hostname reset back to the previous state after you reboot the system.

 

Change Fedora hostname permanently.

 

   On Fedora, to change the hostname permanently you need to edit the network configuration files.  The step below show the way to change hostname by using network configuration tools, and then verify the changes on the hostname configuration files.

 

1.  Backup the network configuration files:

[root@localhost ~]# cp -pr /etc/sysconfig/network /etc/sysconfig/network.bak

[root@localhost ~]#

 

2.  Display the hostname configuration file:

[root@localhost ~]# cat /etc/sysconfig/network

NETWORKING=yes 

HOSTNAME=localhost.localdomain 

[root@localhost ~]#

 

3.  Then open Network tool, go to System on the menu bar, then Administration then click on Network.

Network configuration tools

 

4.  The Network Configuration window load... Go to DNS tab... the example below show that in the Hostname text box display the current hostname of the machine. 

network configuration hostname

 

5.  Replace the current hostname with the new hostname.  the example below show that fedora.labtestproject.com will be my new hostname.

network configuration dns tab

 

6.  Dont forget ... save the changes.  Go to File on Network Configuration menu tab, and click on Save button.

save network configuration

 

7.  Verify the changes by checking the hostname configuration file:

[root@fedora ~]# cat /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=fedora.labtestproject.com

[root@fedora ~]#

 

8.  Reboot your Fedora system or restart network service.

 

9.  Done.. everything should go and look like this, after system reboot :-)

hostname command

[root@fedora ~]# hostname

fedora.labtestproject.com

[root@fedora ~]#

 

Note:

The hosts file under /etc should remain intact....

[root@localhost ~]# cat /etc/hosts 

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost.localdomain localhost

::1 localhost6.localdomain6 localhost6

[root@localhost ~]#

 

Backup... if you ever want to edit this configuration file... make sure that you backup the file first.

[root@localhost ~]# cp -pr /etc/hosts /etc/hosts.bak

 

Tested on Fedora 8 operating system, Gnome desktop on Linux 2.6.21-2952.fc8xen i686 machine.

 

Keywords: hostname, fedora hostname, change hostname, change fedora hostname, change hostname permanently, permanently change hostname 

 


Custom Search