How to Change Centos Hostname

Requirements

  • CentOS 7
  • user account with root privileges
  • Terminal window or putty

Check Existing Hostname

hostnamectl

You can see the current hostname next to static hostname,

Set a New Static Hostname

CentOS 7 only allows Fully Qualified Domain Names (FQDNs) that mean

it allow

  • Lower-case letters
  • Numbers
  • Periods and hyphens
  • 2 and 63 characters
  • hostname must start and end with a number or letter

hostnamectl set-hostname server.promohosts.com

Replace server.promohosts.com with your hostname

After editing the hostname check again by using

hostnamectl
  • 116 Users Found This Useful
Was this answer helpful?

Related Articles

How to Reboot VPS Server

Login to SSH as root user and run the below command reboot

Basic linux command everyone should know

pwd commandcd commandls commandcat commandcp commandmv commandmkdir commandrmdir commandrm...

How to enable SSH access in VPS cPanel servers

For a new cPanel account: 1.Log in to WHM.2.Go to "Account Functions" and choose "Create a New...