1. View the current host name [root@fangjian ~]# hostnamectl Static hostname: brace Pretty hostname: Brace Icon name: computer-vm Chassis: vm Machine ID: 20191225111607875619293640639763 Boot ID: 25ac5021d229471382a26bea3d351de3 Virtualization: kvm Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-1062.9.1.el7.x86_64 Architecture: x86-64 2. Temporarily modify the host name [root@fangjian ~]# hostname yin # Temporarily modify the host name, which will become invalid after shutdown [root@fangjian ~]# hostname yin 3. Permanently change the host name 1. Method 1: Use the hostnamectl command [root@fangjian ~]# hostnamectl set-hostname Brace #Permanently set the user name, which will not expire after shutdown [root@fangjian ~]# hostname brace 2. Method 2: Modify the configuration file /etc/hostname and save and exit [root@fangjian ~]# vi /etc/hostname # Enter vi, delete the old host name, enter the new host name, Esc followed by a colon wq to exit and save the file. # reboot to take effect. The above is a simple method to change the host name in Linux. If you have any additions, please contact the editor. Thank you for your support of 123WORDPRESS.COM. You may also be interested in:
|
<<: Why is it not recommended to use index as key in react?
>>: How to optimize MySQL deduplication operation to the extreme
I'm working on electronic archives recently, ...
Table of contents Preface 1. Background 2. Simula...
Table of contents introduce Usage scenarios Sourc...
On the server, in order to quickly log in to the ...
Preface After reading the previous article about ...
Table of contents 1 Introduction 2 Trigger Introd...
As the number of visits increases, for some time-...
Recent projects involve the creation of a lot of ...
Table of contents 1. Dockerfile 2. pom configurat...
Add a DOCTYPE to the page Since different browser...
The most significant website change in 2011 was Go...
Problem description: Recently, there is a demand ...
1. Database transactions will reduce database per...
Table of contents 1. Two-way binding 2. Will the ...
Build the image Earlier we used various images fo...