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

Example analysis of mysql non-primary key self-increment usage

This article uses an example to illustrate the us...

How to use cursor triggers in MySQL

cursor The set of rows returned by the select que...

A QQ chat room based on vue.js

Table of contents Introduction The following is a...

How to bind domain name to nginx service

Configure multiple servers in nginx.conf: When pr...

Create a movable stack widget function using flutter

This post focuses on a super secret Flutter proje...

js to achieve simulated shopping mall case

Friends who are learning HTML, CSS and JS front-e...

MySQL uses custom functions to recursively query parent ID or child ID

background: In MySQL, if there is a limited level...

How to start multiple MySQL databases on a Linux host

Today, let’s talk about how to start four MySQL d...

Chrome plugin (extension) development guide (complete demo)

Table of contents Written in front Preface What i...