To change hostname on CentOS 7, follow these steps:
Step 1 : Check current hostname
hostname
Step 2 : Set new hostname
sudo hostnamectl set-hostname server-01
Step 3 : Verify the change
hostname
Step 4 : Update /etc/hosts with the new hostname
sudo nano /etc/hosts
Add or modify the line:
127.0.0.1 server-01
Step 5 : Reboot your system
sudo reboot
Congratulations! You have successfully set or changed the hostname on CentOS 7.
Recommended
Mar 29, 2024
Mar 30, 2024
Mar 30, 2024
Mar 30, 2024
Mar 31, 2024
Mar 30, 2024
Apr 01, 2024
Apr 01, 2024
Apr 01, 2024
Apr 01, 2024
Apr 03, 2024
Apr 03, 2024
Apr 03, 2024
Apr 04, 2024
Apr 04, 2024