In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The common way for Linux to modify hostname is to manually append "HOSTNAME=xxxxx" to / etc/sysconfig/network and restart the system, which does not work in Oracle Linux 7.
So how do I configure hostname in Oracle Linux 7?
Derived from:
How to Configure hostname in Oracle Linux 7 (Doc ID 2049221.1)
Solution:
Use any of the following three methods to modify the hostname in Oracle Linux 7
1. Use hostname control utility: hsotnamectl
2. Use NetworkManager command line tool: nmcli
Edit / etc/hostname file directly (a reboot afterwards is required)
1. Use hsotnamectl which is a command-line client to systemd-hostnamed service
Get current hostname status:
[root@localhost ~] # hostnamectl status
Static hostname: localhost.localdomain
Operating System: Oracle Linux Server 7.1
CPE OS Name: cpe:/o:oracle:linux:7:1
Kernel: Linux 3.8.13-55.1.6.el7uek.x86_64
Architecture: x86_64
Set hostname:
[root@localhost ~] # hostnamectl set-hostname oraclelinux.oracle.com
[root@localhost ~] #
Re-login terminal session:
[root@oraclelinux ~] # hostnamectl status
Static hostname: oraclelinux.oracle.com
Operating System: Oracle Linux Server 7.1
CPE OS Name: cpe:/o:oracle:linux:7:1
Kernel: Linux 3.8.13-55.1.6.el7uek.x86_64
Architecture: x86_642. Nmcli
Check current hostname:
[root@localhost ~] # nmcli general hostname
Localhost.localdomain
Modify hostname and restart ystemd-hostnamed service:
[root@localhost ~] # nmcli general hostname oraclelinux.oracle.com
[root@localhost ~] # systemctl restart systemd-hostnamed
Re-login terminal session:
[root@oraclelinux ~] # hostname
Oraclelinux.oracle.com
3. Edit / etc/hostname
View current content:
[root@localhost ~] # cat / etc/hostname
Localhost.localdomain
Replace file content with new hostname:
[root@localhost ~] # echo "oraclelinux.oracle.com" > / etc/hostname
[root@localhost ~] # cat / etc/hostname
Oraclelinux.oracle.com
Restart system and verify:
[root@oraclelinux ~] # hostname
Oraclelinux.oracle.com
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.