Skip to content

Instantly share code, notes, and snippets.

@dungmanh88
Created October 1, 2016 17:06
Show Gist options
  • Save dungmanh88/3171e68cbbf0da177979660c36a80b3e to your computer and use it in GitHub Desktop.
Save dungmanh88/3171e68cbbf0da177979660c36a80b3e to your computer and use it in GitHub Desktop.
Change hostname on Centos 7
hostname <new-hostname>
echo "<new-hostname>" > /etc/hostname
replace old-hostname by new-hostname in /etc/hosts
@dungmanh88
Copy link
Author

hostnamectl set-hostname --> will change /etc/resolv.conf
replace old-hostname by new-hostname in /etc/hosts
re-login

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment