Oracle Linux 7 修改 hostname
Linux修改hostname的常用操作方法是——手工在/etc/sysconfig/network中追加"HOSTNAME=xxxxx"並重啟系統,這個方法在Oracle Linux 7中是不生效的。
那麼在Oracle Linux 7中怎麼配置hostname?
來源於:
How to Configure hostname in Oracle Linux 7 (Doc ID 2049221.1)
解決方案:
請使用如下三種方法的任意一種來修改Oracle Linux 7中的主機名
1. use hostname control utility: hsotnamectl
2. use NetworkManager command line tool: nmcli
3. edit /etc/hostname file directly (a reboot afterwards is required)
那麼在Oracle Linux 7中怎麼配置hostname?
來源於:
How to Configure hostname in Oracle Linux 7 (Doc ID 2049221.1)
解決方案:
請使用如下三種方法的任意一種來修改Oracle Linux 7中的主機名
1. use hostname control utility: hsotnamectl
2. use NetworkManager command line tool: nmcli
3. 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
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 ~]#
[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_64
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_64
2. nmcli
Check current hostname:
[root@localhost ~]# nmcli general hostname
localhost.localdomain
localhost.localdomain
Modify hostname and restart ystemd-hostnamed service:
[root@localhost ~]# nmcli general hostname oraclelinux.oracle.com
[root@localhost ~]# systemctl restart systemd-hostnamed
[root@localhost ~]# systemctl restart systemd-hostnamed
Re-login terminal session:
[root@oraclelinux ~]# hostname
oraclelinux.oracle.com
oraclelinux.oracle.com
3. Edit /etc/hostname
View current content:
[root@localhost ~]# cat /etc/hostname
localhost.localdomain
localhost.localdomain
Replace file content with new hostname:
[root@localhost ~]# echo "oraclelinux.oracle.com" > /etc/hostname
[root@localhost ~]# cat /etc/hostname
oraclelinux.oracle.com
[root@localhost ~]# cat /etc/hostname
oraclelinux.oracle.com
Restart system and verify:
[root@oraclelinux ~]# hostname
oraclelinux.oracle.com
oraclelinux.oracle.com
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12707874/viewspace-2140997/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- How to Change hostname in Oracle Linux 7OracleLinux
- Linux修改hostnameLinux
- linux的hostname修改Linux
- hostname修改理解心得-linuxLinux
- linux 修改hosts檔案以及修改hostnameLinux
- Linux 修改主機名(hostname)Linux
- 深入理解Linux修改hostnameLinux
- 修改Linux主機名Hostname (整理)Linux
- suse11如何修改hostname[Linux基礎]Linux
- [HPUX] HP Unix 修改hostnameUX
- linux CentOS6.x 修改主機名(Hostname)LinuxCentOS
- linux 配置hostnameLinux
- Ubuntu18.04 修改hostnameUbuntu
- Linux 修改本機 /etc/hosts 的 hostName 後經常不生效Linux
- solaris11修改時區、ip、hostname
- 【故障處理】修改主機名導致oracle例項無法啟動暨如何修改hostnameOracle
- 【RAC】如何修改vip 或者vip 對應的hostname
- Linux 7 修改時區不生效Linux
- 修改Linux的時區,RedHat 7LinuxRedhat
- <Linux系統hostname命令詳解>Linux
- Linux修改機器名(centos7)LinuxCentOS
- 新版本linux更新hostname的方法Linux
- Linux下 /etc/hostname 格式及解釋Linux
- ORACLE_HOSTNAME 未定義,em重新配置Oracle
- Oracle Linux 7配置vncserverOracleLinuxVNCServer
- Linux下修改Oracle字符集LinuxOracle
- Oracle Linux 7禁用Transparent HugePagesOracleLinux
- Linux基礎命令—顯示主機名hostnameLinux
- Linux基礎命令---顯示主機名hostnameLinux
- Linux7修改主機IP及主機名Linux
- Oracle Linux 7 Configure DNSOracleLinuxDNS
- Oracle Linux 5 Update 7 downloadOracleLinux
- Oracle Linux 7上安裝Oracle 12cOracleLinux
- URL hostname 屬性
- 【Linux】Virtualbox 安裝 Oracle Linux 7 -64位LinuxOracle
- Linux下Oracle重啟和修改連線數LinuxOracle
- Linux系統Centos7修改或重置root密碼教程。LinuxCentOS密碼
- ubuntu 18.04 更改 hostnameUbuntu