Created
September 13, 2017 06:47
-
-
Save liyang85/7960e285241d377c08f9d7d573641e68 to your computer and use it in GitHub Desktop.
Change hostname on CentOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Part 1: CentOS 6 | |
vim /etc/sysconfig/network | |
HOSTNAME=my_hostname | |
source /etc/sysconfig/network | |
# `hostname` can set the host name until reboot, | |
# it also can show the host name | |
hostname | |
# Part 2: CentOS 7 | |
hostnamectl set-hostname my_hostname | |
hostnamectl status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment