RHEL: Change system’s hostname

# Tested on RHEL 5, 6 & 7


# RHEL 5 & 6 -------------------------------------------------------------------------------

# Change hostname in /etc/sysconfig/network file

# and run following command:

hostname <new_hostname>

# Do not forget to update /etc/hosts if necessary



# RHEL 7 -----------------------------------------------------------------------------------

# Run following command:

hostnamectl set-hostname <new_hostname>

# OR change hostname in /etc/hostname, for permanent change, and run following command:

hostname <new_hostname>

# Do not forget to update /etc/hosts if necessary

 
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
linux manual tools
Viewed 2928 times since Fri, Sep 28, 2018
Linux Health Check Commands
Viewed 3310 times since Fri, Jun 8, 2018
Expand or grow a file system on a Linux VMWare VM without downtime
Viewed 11786 times since Fri, Jul 27, 2018
LUKS dm-crypt/Device encryption GUIDE
Viewed 2465 times since Fri, Jul 13, 2018
Turbocharge PuTTY with 12 Powerful Add-Ons – Software for Geeks #3
Viewed 14846 times since Sun, Sep 30, 2018
How To Create a Linux Swap File
Viewed 2592 times since Fri, Jun 8, 2018
HP-UX - Stunnel Configuration
Viewed 2520 times since Fri, Sep 28, 2018
logrotate Log Rotate Configuration
Viewed 3316 times since Sun, Jan 12, 2020
RHEL: Crash kernel dumps configuration and analysis on RHEL 5
Viewed 7422 times since Sat, Jun 2, 2018
RHCS6: ’fencing’ basics
Viewed 2394 times since Sun, Jun 3, 2018