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
Using stunnel to Encrypt Database Connections
Viewed 2967 times since Fri, Sep 28, 2018
Top 4 Reasons for Node Reboot or Node Eviction in Real Application Cluster (RAC) Environment
Viewed 86257 times since Thu, Jun 21, 2018
How To Add Swap Space on Ubuntu 16.04
Viewed 2223 times since Fri, Jun 8, 2018
Red Hat 8 How to Set Up Automatic Updates for CentOS 8
Viewed 3495 times since Fri, Sep 25, 2020
How log rotation works with logrotate
Viewed 4645 times since Fri, Nov 30, 2018
ZFS: Remove an existing zfs filesystem
Viewed 1990 times since Sun, Jun 3, 2018
Df command in Linux not updating actual diskspace, wrong data
Viewed 2713 times since Wed, May 30, 2018
Need to set up yum repository for locally-mounted DVD on Red Hat Enterprise Linux 7
Viewed 2903 times since Mon, Oct 29, 2018
RHEL7: Create and configure LUKS-encrypted partitions and logical volumes to prompt for password and mount a decrypted file system at boot.
Viewed 11523 times since Mon, Aug 6, 2018
Extending Linux LVM partitions - scripts
Viewed 6390 times since Sun, May 20, 2018