01 January 2010

How to change hostname on Fedora

To change hostname on Fedora, you can do it in 3 ways. That are : edit the /etc/hosts file, edit the /etc/sysconfig/network file and running command line "hostname". As default, content of
/etc/hosts is :

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 lenovo localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6


As default, content of /etc/sysconfig/network file is :

NETWORKING=yes
HOSTNAME=localhost.localdomain


To change hostname, it's better to edit /etc/sysconfig/network file become :

NETWORKING=yes
HOSTNAME=lenovo


Suppose, the hostname is "lenovo". Don't forget to reboot the computer to make effect.

Beside that, you can change hostname with not permanently with command line "hostname". The code is :

# hostname "lenovo"