4
6

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.

Amazon Linux(EC2) ホスト名の変更

4
Last updated at Posted at 2015-04-25

1. hostsファイルの修正

/etc/hosts
127.0.0.1   localhost localhost.localdomain

となっているのを

/etc/hosts
127.0.0.1  example.com  localhost localhost.localdomain

とする。

2. networkファイルの修正

/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
NOZEROCONF=yes
NETWORKING_IPV6=no
IPV6INIT=no
IPV6_ROUTER=no
IPV6_AUTOCONF=no
IPV6FORWARDING=no
IPV6TO4INIT=no
IPV6_CONTROL_RADVD=no

となっているので、HOSTNAMEを修正する。

/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=example.com
NOZEROCONF=yes
NETWORKING_IPV6=no
IPV6INIT=no
IPV6_ROUTER=no
IPV6_AUTOCONF=no
IPV6FORWARDING=no
IPV6TO4INIT=no
IPV6_CONTROL_RADVD=no

3. 再起動する

reboot

または

init 6

※一時的にホスト名を変更したい場合

hostname xxxx

とする。

4
6
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
4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?