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
systemctl Use systemd to Start a Linux Service at Boot
Viewed 5949 times since Mon, Dec 7, 2020
Zabijanie wszystkich procesów użytkownika
Viewed 2815 times since Thu, May 24, 2018
RHCS: Install a two-node basic cluster
Viewed 10181 times since Sun, Jun 3, 2018
12 Linux Rsync Options in Linux Explained
Viewed 12191 times since Wed, Oct 31, 2018
Using IOzone for Linux disk performance analysis
Viewed 8407 times since Wed, Jul 25, 2018
Linux Add a Swap File – HowTo
Viewed 10282 times since Fri, Jun 8, 2018
Linux Audit The Linux security blog about Auditing, Hardening, and Compliance lynis
Viewed 2245 times since Thu, Jan 16, 2020
RHEL: Display swap/RAM size
Viewed 3453 times since Sat, Jun 2, 2018
Linux Proxy Server Settings – Set Proxy For Command Line
Viewed 3802 times since Mon, Feb 18, 2019
logrotate Log Rotate Configuration
Viewed 3316 times since Sun, Jan 12, 2020