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
socat: Linux / UNIX TCP Port Forwarder
Viewed 11283 times since Tue, Aug 6, 2019
RHEL: Displaying/setting kernel parameters - ’sysctl’
Viewed 4299 times since Sat, Jun 2, 2018
LVM: Move allocated PE between Physical Volumes
Viewed 5175 times since Sat, Jun 2, 2018
OpenSSL: Check If Private Key Matches SSL Certificate & CSR
Viewed 4248 times since Mon, Feb 18, 2019
Linux Health Check Commands
Viewed 4357 times since Fri, Jun 8, 2018
RHEL7 slow ssh login
Viewed 5467 times since Tue, Aug 6, 2019
Split and Reassemble files
Viewed 4470 times since Mon, May 28, 2018
List usernames instead of uids with the ps command for long usernames
Viewed 3390 times since Wed, Jul 25, 2018
RHEL: Services basic management - systemd
Viewed 20361 times since Sat, Jun 2, 2018
LVM basic
Viewed 3024 times since Sat, Jun 2, 2018