(30) CentOSでホスト名を変える

投稿者: | 2014年8月23日

2,804 views

この記事は最終更新から 3215日 が経過しています。

CentOS 7の場合

現在の名前を確認する。

[root@ ~]# hostname
localhost
[root@ ~]# hostnamectl
   Static hostname: localhost.localdomain
Transient hostname: localhost
         Icon name: computer
           Chassis: n/a
        Machine ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
           Boot ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64

ホスト名を恒久的に変更する。

[root@ ~]# hostnamectl set-hostname MyHostAAA

変更を確認する。

[root@ ~]# hostname
MyHostAAA
[root@ ~]# hostnamectl
   Static hostname: MyHostAAA
         Icon name: computer
           Chassis: n/a
        Machine ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
           Boot ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64

アクセス数(直近7日): ※試験運用中、BOT除外簡易実装済
  • 2026-06-18: 0回
  • 2026-06-17: 1回
  • 2026-06-16: 0回
  • 2026-06-15: 0回
  • 2026-06-14: 1回
  • 2026-06-13: 0回
  • 2026-06-12: 2回
  • コメントを残す

    メールアドレスが公開されることはありません。 が付いている欄は必須項目です