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

投稿者: | 2014年8月23日

2,690 views

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

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-03-25: 2回
  • 2026-03-24: 1回
  • 2026-03-23: 0回
  • 2026-03-22: 0回
  • 2026-03-21: 0回
  • 2026-03-20: 1回
  • 2026-03-19: 0回
  • コメントを残す

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