Change Hostname in CentOS or Ubuntu I choose the manual way type this to display current hostname: hostname and type this to change it: sudo hostnamectl set-hostname NewName