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

投稿者: | 2014年8月23日

2,783 views

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

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-03: 0回
  • 2026-06-02: 2回
  • 2026-06-01: 3回
  • 2026-05-31: 1回
  • 2026-05-30: 0回
  • 2026-05-29: 2回
  • 2026-05-28: 0回
  • コメントを残す

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