Three methods to modify the hostname of Centos7

Three methods to modify the hostname of Centos7

Method 1: hostnamectl modification

Step 1 Check the host name

hostname

Step 2 Change the host name

Command form

hostnamectl set-hostname hostname

Revise

hostnamectl set-hostname Master

Step 3 Check the host name again

hostname

No need to restart, just open a new session to change to a new hostname

Method 2: By modifying the file

Modify the file

vi /etc/hostname add hostname

Slave01

vi /etc/sysconfig/network Add the correspondence between IP and hostname

10.238.162.33 Slave01

Reboot to take effect

Method 3: Temporarily modify the host name

hostname Slave01

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • Alibaba Cloud Centos7 installation and configuration of SVN
  • How to add Nginx to system services in CentOS7
  • Detailed explanation of Nginx installation, SSL configuration and common commands under Centos7.x
  • Solution for not being able to use pip after installing python3.7.1 on centos6.5
  • How to configure Nginx virtual host in CentOS 7.3
  • Solution to the error when installing Docker on CentOS version
  • How to set up scheduled backup tasks in Linux centos
  • Linux centOS installation JDK and Tomcat tutorial
  • How to build Jenkins+Maven+Git continuous integration environment on CentOS7
  • Centos7.5 configuration java environment installation tomcat explanation

<<:  mysql5.7.19 winx64 installation and configuration method graphic tutorial (win10)

>>:  Detailed explanation and summary of the URL for database connection

Recommend

How to use the Linux basename command

01. Command Overview basename - strip directories...

Build Maven projects faster in Docker

Table of contents I. Overview 2. Conventional mul...

Ubuntu 16.04 mysql5.7.17 open remote port 3306

Enable remote access to MySQL By default, MySQL u...

WeChat applet realizes the effect of swiping left to delete list items

This article shares the specific code for WeChat ...

How to run sudo command without entering password in Linux

The sudo command allows a trusted user to run a p...

Summary of methods to include file contents in HTML files

In the forum, netizens often ask, can I read the ...

Steps to run ASP.NET Core in Docker container

There are too much knowledge to learn recently, a...

Example of using CSS3 to customize the style of input multiple-select box

Principle: First hide the input element, then use...

Vue+ElementUI implements paging function-mysql data

Table of contents 1. Problem 2. Solution 2.1 Pagi...

Detailed explanation of how to install PHP curl extension under Linux

This article describes how to install the PHP cur...

Vite introduces the implementation of virtual files

Table of contents background Importing virtual fi...

MySQL variable principles and application examples

In the MySQL documentation, MySQL variables can b...

Detailed usage of kubernetes object Volume

Overview Volume is the abstraction and virtualiza...

How to handle forgotten passwords in Windows Server 2008 R2

What to do if you forget Windows Server 2008R2 So...