在Oracle Linux7中通過(guò)修改/etc/sysconfig/network這種方式并不能修改Oracle Linux 7的主機(jī)名。為了對(duì)Oracle Linux 7修改主機(jī)名,可以通過(guò)執(zhí)行以下任何一種方法來(lái)實(shí)現(xiàn):
1.使用主機(jī)名控制工具(hostnamectl)
2.使用網(wǎng)絡(luò)管理命令行工具(nmcli)
3.編輯/etc/hostname文件

1.使用主機(jī)名控制工具(hostnamectl),它是systemd-hostnamed服務(wù)的命令行工具
獲取當(dāng)前主機(jī)名:
[root@jytest ~]# hostnamectl status
Static hostname: jytest
Icon name: computer
Chassis: n/a
Machine ID: 66203d1dd6f54e5da356f986ac82f473
Boot ID: e8ca08f1d73347358f085a6d0f5ed201
Virtualization: vmware
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
修改主機(jī)名:
[root@jytest ~]# hostnamectl set-hostname jytest3
重新登錄獲取當(dāng)前主機(jī)名可以看到主機(jī)名已經(jīng)變成了jytest3
[root@jytest3 ~]# hostnamectl status
Static hostname: jytest3
Icon name: computer
Chassis: n/a
Machine ID: 66203d1dd6f54e5da356f986ac82f473
Boot ID: e8ca08f1d73347358f085a6d0f5ed201
Virtualization: vmware
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.使用網(wǎng)絡(luò)管理命令行工具(nmcli)
獲取當(dāng)前主機(jī)名
[root@jytest3 ~]# nmcli general hostname jytest3
修改主機(jī)名并重新啟動(dòng)systemd-hostnamed服務(wù)
[root@jytest3 ~]# nmcli general hostname jytest2 [root@jytest3 ~]# systemctl restart systemd-hostnamed
重新登錄并檢查當(dāng)前主機(jī)名
[root@jytest2 ~]# hostname jytest2
3.編輯/etc/hostname文件
獲取當(dāng)前主機(jī)名
[root@jytest2 ~]# cat /etc/hostname jytest2
修改主機(jī)名
[root@jytest2 ~]# echo "jytest1" > /etc/hostname [root@jytest2 ~]# cat /etc/hostname jytest1
重啟系統(tǒng)并檢查主機(jī)名
[root@jytest2 ~]# reboot [root@jytest1 ~]# hostname jytest1 [root@jytest1 ~]# cat /etc/hostname jytest1
引用:How to Configure hostname in Oracle Linux 7 (Doc ID 2049221.1)
當(dāng)前文章:HowtoChangehostnameinOracleLinux7-創(chuàng)新互聯(lián)
網(wǎng)站網(wǎng)址:http://www.chinadenli.net/article12/djhegc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作、網(wǎng)站收錄、電子商務(wù)、手機(jī)網(wǎng)站建設(shè)、網(wǎng)站維護(hù)、服務(wù)器托管
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容