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

Preventing SQL injection in web projects

Table of contents 1. Introduction to SQL Injectio...

HTML+CSS to achieve layered pyramid example

This article mainly introduces the example of imp...

HTML table tag tutorial (20): row background color attribute BGCOLOR

The BGCOLOR attribute can be used to set the back...

Setting up shared folders in Ubuntu virtual machine of VMWare14.0.0

This is my first blog post. Due to time constrain...

Summarize the common properties of BigIn functions in JavaScript

Table of contents 1. Overview 2. Attributes 1. Ma...

Detailed explanation of HTML basics (Part 2)

1. List The list ul container is loaded with a fo...

Zabbix monitoring solution - the latest official version 4.4 [recommended]

Zabbix 2019/10/12 Chenxin refer to https://www.za...

Implementing the preview function of multiple image uploads based on HTML

I recently wrote a script for uploading multiple ...

How to solve the error "ERROR 1045 (28000)" when logging in to MySQL

Today, I logged into the server and prepared to m...

Web page experience: planning and design

1. Clarify the design direction <br />First,...

JavaScript Function Currying

Table of contents 1 What is function currying? 2 ...