Questions? Feedback? powered by Olark live chat software
Knowledgebase
Author Avatar

How to Change Your Linux Hostname

Written by: on 22 March 2013 10:08 AM 22 March 2013 10:08 AM

Change hostname or server name of a Linux system. Learn following step by step tips to do it yourself.

To change the hostname on your actual VPS, you need to login via SSH (see: https://www.vpsblocks.com.au/support/Knowledgebase/Article/View/41/0/how-do-i-use-ssh)

Ubuntu

Type: /bin/hostname mynewhostname

Type: nano /etc/hosts

Edit the file and then save it.

* Note: If you do not have nano installed, you can install it by running:
apt-get install nano

CentOS

Type: hostname mynewhostname

Type: pico /etc/sysconfig/network

Edit the file by changing the hostname entry if there is one, and then save it.

* Note: If you do not have pico installed, you can install it by running:
yum install pico

CentOS 7

Type: hostname mynewhostname

Type: pico /etc/hostname

Edit the file by changing the hostname entry and then save it.

Type: pico /etc/hosts

Edit the file by changing the hostname entry for 127.0.0.1 and then save it.

(0 vote(s))
Helpful
Not helpful

Comments (0)