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
How to find the largest files and directories in Linux?
Viewed 4076 times since Sun, May 20, 2018
stunnel basics and pki standards
Viewed 10281 times since Fri, Sep 28, 2018
How to schedule crontab in Unix Operating Systems
Viewed 2640 times since Fri, Jun 8, 2018
Linux Chage Command to Set Password Aging for User
Viewed 3308 times since Tue, Sep 11, 2018
RHEL: Forgotten ’root’ password / using single-user to gain access
Viewed 8769 times since Sat, Jun 2, 2018
chrt command: Set / Manipulate Real Time Attributes of a Linux Process
Viewed 12119 times since Mon, Feb 17, 2020
Secure Secure Shell
Viewed 12672 times since Fri, Aug 21, 2020
Setup SSL Tunnel Using Stunnel on Ubuntu
Viewed 3762 times since Fri, Sep 28, 2018
CentOS / RHEL 7 : Configuring an NFS server and NFS client Linux NFS
Viewed 17962 times since Fri, Feb 21, 2020
RHEL7: Configure automatic updates.
Viewed 2560 times since Wed, Oct 17, 2018