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

How to Change hostname in Oracle Linux 7

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

You cannot change the hostname of Oracle Linux7 by modifying / etc/sysconfig/network in Oracle Linux7. To change the hostname for Oracle Linux 7, you can do this by performing any of the following methods:

1. Use the hostname control tool (hostnamectl)

two。 Use the network management command line tool (nmcli)

3. Edit / etc/hostname file

1. Use the hostname control tool (hostnamectl), which is the command line tool for systemd-hostnamed services

Get the current hostname:

[root@jytest ~] # hostnamectl status Static hostname: jytest Icon name: computer Chassis: n Machine ID a Machine ID: 66203d1dd6f54e5da356f986ac82f473 Boot ID: e8ca08f1d73347358f085a6d0f5ed201 Virtualization: vmware Operating System: Oracle Linux Server 7.1CPE OS Name: cpe:/o:oracle:linux:7:1 Kernel: Linux 3.8.13-55.1.6.el7uek.x86_64 Architecture: x86 * 64

Modify the hostname:

[root@jytest ~] # hostnamectl set-hostname jytest3

Log in again to get the current hostname and you can see that the hostname has become jytest3

[root@jytest3 ~] # hostnamectl status Static hostname: jytest3 Icon name: computer Chassis: n Machine ID a Machine ID: 66203d1dd6f54e5da356f986ac82f473 Boot ID: e8ca08f1d73347358f085a6d0f5ed201 Virtualization: vmware Operating System: Oracle Linux Server 7.1CPE OS Name: cpe:/o:oracle:linux:7:1 Kernel: Linux 3.8.13-55.1.6.el7uek.x86_64 Architecture: x86 * 64

two。 Use the network management command line tool (nmcli)

Get the current hostname

[root@jytest3 ~] # nmcli general hostnamejytest3

Modify the hostname and restart the systemd-hostnamed service

[root@jytest3 ~] # nmcli general hostname jytest2 [root@jytest3 ~] # systemctl restart systemd-hostnamed

Log in again and check the current hostname

[root@jytest2 ~] # hostnamejytest2

3. Edit / etc/hostname file

Get the current hostname

[root@jytest2 ~] # cat / etc/hostnamejytest2

Modify hostname

[root@jytest2 ~] # echo "jytest1" > / etc/hostname [root@jytest2 ~] # cat / etc/hostnamejytest1

Restart the system and check the hostname

[root@jytest2 ~] # reboot [root@jytest1 ~] # hostnamejytest1 [root@jytest1 ~] # cat / etc/hostnamejytest1

Reference: How to Configure hostname in Oracle Linux 7 (Doc ID 2049221.1)

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