Skip to content

Instantly share code, notes, and snippets.

@1901
Last active July 18, 2019 13:33
Show Gist options
  • Save 1901/2bac3987fbf2d49ef7ebc744c592e3d9 to your computer and use it in GitHub Desktop.
Save 1901/2bac3987fbf2d49ef7ebc744c592e3d9 to your computer and use it in GitHub Desktop.
[CentOS change hostname] #linux #hostname
# CentOS 6.x
hostname newHostName
vi /etc/sysconfig/network
# CentOS 7.x
hostnamectl set-hostname newHostName
# Change oldHostName to newHostName
vim /etc/hosts
# reboot and check hostname
reboot
hostname # CentOS 6.x
hostnamectl # CentOS 7.x
# ref: https://phoenixnap.com/kb/how-to-set-or-change-a-hostname-in-centos-7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment