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
Jak wygenerować silne hasła jednorazowe w Linuksie?
Viewed 2209 times since Thu, May 24, 2018
Kernel sysctl configuration file for Linux
Viewed 5094 times since Fri, Aug 3, 2018
ubuntu How to Reset Forgotten Passwords in Ubuntu 16.04
Viewed 3068 times since Tue, Dec 8, 2020
Oracle Linux 7 – How to audit changes to a trusted file such as /etc/passwd or /etc/shadow
Viewed 2818 times since Wed, Jul 25, 2018
RHCS6: Show/Add GFS2/GFS journals
Viewed 12583 times since Sun, Jun 3, 2018
Linux: how to monitor the nofile limit
Viewed 10487 times since Wed, Jul 25, 2018
Using stunnel and TinyProxy to obfuscate HTTP traffic
Viewed 6601 times since Fri, Sep 28, 2018
www.unixarena.com
Viewed 2305 times since Fri, Jul 27, 2018
Top 20 OpenSSH Server Best Security Practices - good article
Viewed 10384 times since Mon, Oct 1, 2018
Use Fail2ban to Secure Your Server
Viewed 14448 times since Fri, Jul 5, 2019