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
Index » Community Contributions » System encryption using LUKS and GPG encrypted keys for arch linux
Viewed 1591 times since Fri, Jul 13, 2018
OEL 7 – How to disable IPv6 on Oracle Linux 7 – Follow Up
Viewed 8615 times since Wed, Jul 25, 2018
A Quick and Practical Reference for tcpdump
Viewed 11408 times since Fri, Jul 27, 2018
8 Vim Tips And Tricks That Will Make You A Pro User
Viewed 2332 times since Fri, Apr 19, 2019
Easily Monitor CPU Utilization in Linux Terminal With Stress Terminal UI
Viewed 2878 times since Thu, Apr 18, 2019
RHEL: Reserved space on a ext2/ext3/ext4 filesystem
Viewed 3537 times since Sun, May 27, 2018
Install Security Patches or Updates Automatically on CentOS and RHEL
Viewed 1105 times since Fri, Oct 26, 2018
How To Create a Linux Swap File
Viewed 1717 times since Fri, Jun 8, 2018
LVM: Remove an existing Volume Group
Viewed 4385 times since Sat, Jun 2, 2018
Secure NTP with NTS
Viewed 7336 times since Sun, Dec 6, 2020