Change Redhat/ CentOS hostname permanently

FREQUENTLY ASKED QUESTIONS  (Linux Networking)
Q: How to change hostname permanently in Redhat/CentOS ?

This post covers changing the hostname permanently in Fedora, CentOS, Redhat, etc.
The default hostname will be look like "localhost.localdomain" or something like that.
Step1: Edit the network configuration file located in "/etc/sysconfig/"
[root@server ~#]cd /etc/sysconfig/
[root@server ~#]vi network
#in the 3rd line edit and specify the new hostname of the system.
HOSTNAME=webserver













Step2: Restart the system to take effect the new hostname.
[root@server ~#]reboot

Step3: After restarting the system verify the new hostname
[root@server ~#]hostname
webserver


Note: You can temporary change hostname by the below command
[root@server ~#]hostname dbserver
(this changes the current hostname to "dbserver" untill reboot the system.

0 comments:

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons