Changing the hostname of a Linux machine

Discussion in 'Linux' started by pradeep, Jun 28, 2006.

  1. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    This can be achieved in three steps.

    1) Issue the command :

    root@srv# hostname new.host.name

    2) Change the network configuration file /etc/sysconfig/network to include the line :

    HOSTNAME=new-host-name

    3) Restart the systems which relied on the hostname (or reboot):

    root@srv# service network restart

    Restart desktop

    i)
    Bring down system to console mode :

    root@srv# init 3


    ii) Bring up X Windows:

    root@srv# init 5


    One may also want to check the file /etc/hosts for an entry using the system name which allows the system to be self aware.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice