In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-26 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.