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 ssh Hide OpenSSH Version Banner
Viewed 51623 times since Wed, Apr 22, 2020
RHEL : How to deal with “CLOSE_WAIT” and “TIME_WAIT” connection
Viewed 26353 times since Thu, Feb 14, 2019
RHEL: GPT/MBR partition tables (using disks larger than 2 TiB)
Viewed 12404 times since Sun, May 27, 2018
RHEL: Displaying system info (firmware, serial numbers... )
Viewed 12136 times since Sun, May 27, 2018
Logowanie za pomocą kluczy Secure Shell
Viewed 3039 times since Thu, May 24, 2018
10 Linux DIG Command Examples for DNS Lookup
Viewed 11183 times since Sun, Sep 30, 2018
LVM basic
Viewed 2286 times since Sat, Jun 2, 2018
LVM: Rename root VG/LV
Viewed 7720 times since Sat, Jun 2, 2018
How To Run Multiple SSH Command On Remote Machine And Exit Safely
Viewed 4426 times since Tue, Aug 6, 2019
RHEL: udev rules basics
Viewed 8948 times since Sat, Jun 2, 2018