Linux Tricks and Techniques

For Linux Experts

Use the website for easy leaning of Linux

Friday, 17 November 2017

How to change Hostname permanently in Linux

Linux allow us to change the hostname permanently if required. It could also be changed on temporary basis. Below I am showing you how to change the hostname permanently and on temporary basis. It is very easy task to change hostname in Linux. Please go through the below explanation.


First let me show you the hostname of my server then we will change this hostname temporarily.

So the above image show the current hostname of my server. Now in the below image I am changing this hostname temporarily. It means that once the server is rebooted the hostname will get changed to the previous hostname. 


To make this change permanently we need to edit some files like /etc/hosts and /etc/sysconfig/network. Once we make the entry of this hostname in these files it will not be changed till the time network service is not restarted. Let me show you the same.


Similarly edit /etc/hosts file.


After editing these two files restart /etc/sysconfig/network service and hostname will get changed permanently.

# /etc/sysconfig/network restart.

Thanks





No comments:
Write comments