Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A simple method for Linux to modify hostname

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. View the current hostname

[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

two。 Temporarily modify the hostname

[root@fangjian ~] # hostnameyin # temporarily modify the hostname and disable [root@fangjian ~] # hostnameyin after shutdown

3. Permanently modify the hostname

1. Method 1: use hostnamectl command

[root@fangjian ~] # hostnamectl set-hostname Brace # set the user name permanently and will not fail [root@fangjian ~] # hostnamebrace after shutdown

2. Method 2: modify configuration file / etc/hostname save and exit

[root@fangjian ~] # vi / etc/hostname # enter vi, delete the old hostname and enter the new hostname. After Esc, the colon wq exits and saves the brace # reboot restart takes effect.

The above is a simple way for linux to modify the host name. If you have anything to add, you can contact the editor. Thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report