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
Linux - Cannot login from remote console but can access via ssh
Viewed 5871 times since Fri, Jun 8, 2018
RHEL: Remove existing SAN LUNs
Viewed 14762 times since Sat, Jun 2, 2018
Check Detailed CPU Information In Linux With CoreFreq [Advanced]
Viewed 2935 times since Thu, Apr 18, 2019
Creating SWAP partition using FDISK & FALLOCATE commands
Viewed 4207 times since Thu, Jan 16, 2020
Linux Add a Swap File – HowTo
Viewed 10657 times since Fri, Jun 8, 2018
Manage Linux Password Expiration and Aging Using chage
Viewed 5353 times since Tue, Sep 11, 2018
SPRAWDZONA KONFIGURACJA RSYSLOG I LOGROTATE, JAKO ZEWNĘTRZNEGO SERWERA SYSLOG
Viewed 4426 times since Fri, Nov 30, 2018
Open SSL HowTo: Decode SSL Certificate
Viewed 6597 times since Mon, Feb 18, 2019
How To Use the Linux Auditing System on CentOS 7
Viewed 4551 times since Fri, Apr 5, 2019
How to mount software RAID1 member using mdadm
Viewed 3550 times since Wed, Oct 3, 2018