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
Do you Know These 5 Use of V$session View ?
Viewed 107256 times since Thu, Jun 21, 2018
Understanding logrotate utility part 1
Viewed 1779 times since Fri, Nov 30, 2018
LVM: Rename root VG/LV
Viewed 7649 times since Sat, Jun 2, 2018
LVM: Create a new Volume Group
Viewed 2110 times since Sat, Jun 2, 2018
20 Practical Examples of RPM Commands in Linux rpm
Viewed 8035 times since Mon, Feb 18, 2019
RHEL: What is "SysRq key" and how to use it
Viewed 5360 times since Sat, Jun 2, 2018
RHEL: Rebuilding the initial ramdisk image
Viewed 7523 times since Sat, Jun 2, 2018
RHEL: Forgotten ’root’ password / using single-user to gain access
Viewed 7494 times since Sat, Jun 2, 2018
Easily Find Bugs In Shell Scripts With ShellCheck
Viewed 3348 times since Thu, Apr 18, 2019
20 Linux YUM (Yellowdog Updater, Modified) Commands for Package Management YUM
Viewed 11372 times since Thu, Oct 25, 2018