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
OEL 7 – How to disable IPv6 on Oracle Linux 7
Viewed 15818 times since Fri, Aug 3, 2018
Df command in Linux not updating actual diskspace, wrong data
Viewed 1380 times since Wed, May 30, 2018
How to retrieve and change partition’s UUID Universally Unique Identifier on linux
Viewed 1059 times since Tue, Jul 17, 2018
Linux / UNIX: DNS Lookup Command
Viewed 8605 times since Sun, Sep 30, 2018
Linux Customizing Bash
Viewed 441 times since Sun, Dec 6, 2020
Linux An introduction to swap space on Linux systems
Viewed 1343 times since Thu, Jan 23, 2020
Stunnel Setup
Viewed 12941 times since Fri, Sep 28, 2018
bash mistakes This page is a compilation of common mistakes made by bash users. Each example is flawed in some way.
Viewed 7339 times since Sun, Dec 6, 2020
How to clear swap memory in Linux
Viewed 640 times since Mon, Nov 23, 2020
Migrate a Linux System from Red Hat Enterprise to CentOS
Viewed 8736 times since Fri, May 15, 2020