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 5387 times since Fri, Jun 8, 2018
15 Linux Yum Command Examples – Install, Uninstall, Update Packages
Viewed 3558 times since Thu, Oct 25, 2018
Jak wygenerować silne hasła jednorazowe w Linuksie?
Viewed 2458 times since Thu, May 24, 2018
BIND for the Small LAN
Viewed 3551 times since Sun, May 20, 2018
How to use yum command on CentOS/RHEL
Viewed 11181 times since Wed, Oct 17, 2018
LVM: Reduce an existing Logical Volume / Filesystem
Viewed 3695 times since Sat, Jun 2, 2018
20 Practical Examples of RPM Commands in Linux rpm
Viewed 8161 times since Mon, Feb 18, 2019
How to find the largest files and directories in Linux?
Viewed 3549 times since Sun, May 20, 2018
Using grep to find string in files
Viewed 2389 times since Fri, May 15, 2020
RHEL: Resize/disable /dev/shm filesystem
Viewed 15173 times since Sun, May 27, 2018