All Products
Search
Document Center

:Change the hostname in CentOS7

Last Updated:Dec 28, 2020

Overview

Compared with CentOS6, CentOS7 has changed a lot. This directly affects the service performance. This article aims to explain how to modify the hostname in centos7.

Detail

Alibaba Cloud reminds you that:

  • Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted sensitive information such as the logon account and password in the Alibaba Cloud Management Console, we recommend that you modify such information in a timely manner.
  • Update the host name by modifying the file, edit the /etc/hostname file to replace the original content and restart the server.
  • Run the following command to modify the configuration without restarting the server.
    hostnamectl --static set-hostname [$Hostname]
    Note: [$Hostname] is your Hostname.

Application scope

  • Elastic Compute Service
  • Simple Application Server