General

How To Change Hostname On Linux

Avatar Written by Arief Fajar Nursyamsu · 26 sec read > 1.510 views

I need to migrate my old database server (let say: intranet) to new server (intranet2). The software at the client was developed to be connected to server using hostname instead of IP address. I need to change the hostname of new server because I give it different hosname (of course it will causes a conflict if you have two machines with same name).

To change new server’s hostname from intranet2 to intranet, here are the steps:

  1. Login to Linux shell as root
  2. Run this command to change hostname

    hostname yournewhostname
    eg: hostname intranet (to change hostname to intranet)

  3. Edit hostname file to make sure that the hostname is set correctly when the server reboot

    Hostname file usually located at /etc/hostname

  4. Done

That’s all.

Written by Arief Fajar Nursyamsu
A blogger and now managing a SOHO company selling educational toys. I also run web development and content writing business. Blog and internet marketing as well as SEO are what I am doing a lot. Profile

2 Replies to “How To Change Hostname On Linux”

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

This site uses Akismet to reduce spam. Learn how your comment data is processed.