In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Background introduction
Why modify the host name? Suppose we have multiple CentOS servers, and each server runs this different service role. If the host name is the same, we may appear in the production environment and cause service downtime due to improper operation. Then, the impact is unpredictable. Let's teach friends to change the host name.
Modification method
Centos 6.6 change the host name
Temporarily modify the host name
[root@localhost ~] # hostname 192168088102-NFS-Server
# log in to the Linux system again after logging out, and the host name has changed. However, the host name of the restart system will become invalid.
[root@192168088102-NFS-Server ~] # hostname
192168088102-NFS-Server
Edit the vi / etc/hosts file, add "192168088102-NFS-Server" at the end of the line, notice the space, and change it to the desired host name.
[root@localhost ~] # cat / etc/hosts
127.0.0.1 localhost.localdomain localhost.localdomain localhost4 localhost4.localdomain4 localhost 192168088102-NFS-Server
: 1 localhost.localdomain localhost.localdomain localhost6 localhost6.localdomain6 localhost 192168088102-NFS-Server
Edit the vi / etc/sysconfig/network file
# replace part of the localhost.localdomain with the new host name
[root@localhost ~] # cat / etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
# effective after restart
[root@localhost ~] # reboot
[root@192168088102-NFS-Server ~] # hostname
192168088102-NFS-Server
Centos 7.6 change host name
Temporarily modify the host name
[root@localhost ~] # hostname 192168088102-NFS-Server
[root@localhost ~] # hostname
192168088102-NFS-Server
# Log in again after logging out, and the host name has been temporarily modified successfully
[root@192168088102-NFS-Server ~] # hostname
192168088102-NFS-Server
Permanently modify the host name
Method 1:
Hostnamectl set-hostname ${Host name to be set}
[root@localhost ~] # hostnamectl set-hostname 192168088102-NFS-Server
[root@localhost ~] # reboot
Method 2:
Edit the / etc/hostname file and add the host name as 192168088102-NFS-Server
[root@localhost ~] # cat / etc/hostname
192168088102-NFS-Server
[root@localhost ~] # reboot
After rebooting the system, the host name is 192168088102-NFS-Server
Reminder:
After modifying the host name, use ping ${newly changed host name} to see if you can ping, and whether the returned result is the current host IP. If so, it is normal. Otherwise, you need to add local domain name resolution.
Vi / etc/hosts
Add a line 192.168.88.102 192168088102-NFS-Server
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.