36
35

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 5 years have passed since last update.

AmazonLinuxのホスト名を変更するには

Last updated at Posted at 2015-03-04

別にEC2限定ではないが。

1.hostnameを設定

sudo hostname webserver.domain.com

2./etc/sysconfig/networkを変更

HOSTNAME=webserver.domain.com

3./etc/hostsを変更

127.0.0.1 webserver.domain.com webserver localhost localhost.localdomain

4./etc/profile.d/prompt.shを変更
忘れがちなのがシェルプロンプトの [user@host ~]のhost部分

/etc/profile.d/prompt.sh
export NICKNAME=webserver

書き換えて、再ログインするなどで、以下のようになる

[ec2-user@webserver ~]$

参考

36
35
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
36
35

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?