Ubuntu 21.10にホスト名を設定する方法

2021年10月25日

OSバージョンを確認
# cat /etc/issue
Ubuntu 21.10 \n \l

1.一時的にホスト名を変更
# 現在のホスト名を表示
root@ubuntu:~# hostname
ubuntu

# ホスト名変更
root@ubuntu:~# hostname arkgame
root@ubuntu:~# hostname
arkgame #ホスト名が変更される

2.恒久的にホスト名を変更

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
root@ubuntu:~# hostnamectl set-hostname cft
root@ubuntu:~# hostnamectl
Static hostname: cft
Icon name: computer-vm
Chassis: vm
Machine ID: 00b20c68521346439207dec515996e99
Boot ID: d632623a38394fa797b868a4e0f04cae
Virtualization: vmware
Operating System: Ubuntu 21.10
Kernel: Linux 5.13.0-20-generic
Architecture: x86-64
Hardware Vendor: VMware, Inc.
Hardware Model: VMware Virtual Platform
root@ubuntu:~# hostnamectl set-hostname cft root@ubuntu:~# hostnamectl Static hostname: cft Icon name: computer-vm Chassis: vm Machine ID: 00b20c68521346439207dec515996e99 Boot ID: d632623a38394fa797b868a4e0f04cae Virtualization: vmware Operating System: Ubuntu 21.10 Kernel: Linux 5.13.0-20-generic Architecture: x86-64 Hardware Vendor: VMware, Inc. Hardware Model: VMware Virtual Platform
root@ubuntu:~# hostnamectl set-hostname cft
root@ubuntu:~# hostnamectl
 Static hostname: cft
       Icon name: computer-vm
         Chassis: vm
      Machine ID: 00b20c68521346439207dec515996e99
         Boot ID: d632623a38394fa797b868a4e0f04cae
  Virtualization: vmware
Operating System: Ubuntu 21.10
          Kernel: Linux 5.13.0-20-generic
    Architecture: x86-64
 Hardware Vendor: VMware, Inc.
  Hardware Model: VMware Virtual Platform

 

Ubuntu 21.10

Posted by arkgame