In the computer world, we assign a name to computers as we do to humans. This is called hostname. So in this article, I will show you how to Change Hostname in Linux / Unix operating system. it’s very simple. we have two ways to do this job.
Change Hostname in Linux
1. Permanent way: (after the change we need to restart the system)
2. Temporary way: (temporary way effect immediately and when you reboot your system the changes are removed as default)
NOTE:-Before applying changes, you must check your current hostname using the “hostname” command. The Hostname command shows you the present hostname of your system.
Permanently
1. Permanent way:- Change your hostname, and edit your network file using the below command.
#vi /etc/sysconfig/network
HOSTNAME=NEW_HOSTNAME.COM (give HOSTNAME WHICH IS YOU WANT TO SET)
Then save the file and exit, Now reboot your system then you check your hostname, it’s changed permanently.
#hostname (to check your current hostname)
Temporary
2. Temporary way:- you can use the “hostname” command to change the existing hostname temporarily.
#hostname ocptechnology.com (your new hostname)
Then check
#hostname (to check your current hostname)
Read - How to configure yum server
Connect with me on:
Instagram: https://www.instagram.com/shripaldba
Linkedin: https://www.linkedin.com/in/shripal-singh
Twitter: https://twitter.com/ocptechnology
Facebook: https://www.facebook.com/ocptechnology
YouTube:https://www.youtube.com/ocptechnology
One thought on “How to change “HOSTNAME” Permanently and Temporary in Linux”