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
3 Ways to Check Linux Kernel Version in Command Line
Viewed 12415 times since Fri, Apr 19, 2019
Linux An introduction to swap space on Linux systems
Viewed 3079 times since Thu, Jan 23, 2020
Set Up SSH Tunneling on a Linux / Unix / BSD Server To Bypass NAT
Viewed 11925 times since Fri, May 15, 2020
Migrate a Linux System from Red Hat Enterprise to CentOS
Viewed 11035 times since Fri, May 15, 2020
RHEL: How to rebuild and/or patch a RPM package
Viewed 9680 times since Sat, Jun 2, 2018
awk printf
Viewed 16508 times since Wed, Aug 19, 2020
Linux: how to monitor the nofile limit
Viewed 11480 times since Wed, Jul 25, 2018
Improve security with polyinstantiation
Viewed 14243 times since Fri, May 15, 2020
Using IOzone for Linux disk performance analysis
Viewed 9185 times since Wed, Jul 25, 2018
CONFIGURE FOR ASM Linux
Viewed 6149 times since Sat, Jun 2, 2018