1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

サーバーのホスト名を変更する方法

Posted at

サーバーのホスト名変更

set-hostnameで変更ができる。

# hostnamectl set-hostname {ホスト名}

コマンド打っただけだと、ターミナルの表示は変わらず。
変更した状態で再ログインすると、ターミナルの表示が変わる。

ホスト名確認

unameコマンドやhostnameコマンドで変わっていることを確認できる。
現場では、ログインしてる装置があっているかどうか確認のために使う場合もある。

# uname -n
{ホスト名}

# hostname
{ホスト名}

ちなみに、ホスト名は/etc/hostnameに格納されている。

# cat /etc/hostname 
{ホスト名}

一時的に変更する

hostnameコマンドで一時的な変更は可能。恒久的な変更はhostnamectlで変更する。

# hostname {ホスト名}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?