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 Clear RAM Memory Cache, Buffer and Swap Space on Linux
Viewed 4344 times since Mon, Nov 23, 2020
How to Configure ‘FirewallD’ in RHEL/CentOS 7 and Fedora 21
Viewed 11891 times since Wed, Oct 9, 2019
LVM: Create a new Logical Volume / Filesystem
Viewed 2850 times since Sat, Jun 2, 2018
Oracle Linux 7 – How to audit changes to a trusted file such as /etc/passwd or /etc/shadow
Viewed 3881 times since Wed, Jul 25, 2018
FIO (Flexible I/O) – a benchmark tool for any operating system
Viewed 20583 times since Wed, Jul 25, 2018
Use Fail2ban to Secure Your Server
Viewed 16580 times since Fri, Jul 5, 2019
Find All Large Files On A Linux System
Viewed 3007 times since Mon, Oct 29, 2018
RHEL: Rename a network interface on RHEL 7
Viewed 11943 times since Sat, Jun 2, 2018
UUIDs and Linux: Everything you ever need to know [Update]
Viewed 5813 times since Tue, Jul 17, 2018
OpenSSL: Check If Private Key Matches SSL Certificate & CSR
Viewed 4075 times since Mon, Feb 18, 2019