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.

[OCI] hostnameの変更で詰まったのでメモ

Posted at

概要

Linux kernelを搭載しているOSにおいて、

$ hostnamectl set-hostname <hostname>

でhostnameを変更できるのは一般に知られていることだが、
OCIのOracle Linuxで変更時、再起動したら元のhostnameに戻る事象が発生したので、変更方法をメモ。

方法

/etc/oci-hostname.confの変更が必要。

$ sudo sed -ie "s/PRESERVE_HOSTINFO=0/PRESERVE_HOSTINFO=2" /etc/oci-hostname.conf

確認

実際に実施して確認してみる。

1. vNICを修正する。

アタッチされているvNICのhostnameを、修正したいhostnameにする。
今回は hostname1hostname2 に変更したい状況を想定している。

2. 変更後、再起動してみる。

$ hostname
hostname1
$ sudo hostnamectl set-hostname hostname2
$ sudo reboot

3. 変更が適用されているのがわかる。

$ hostname
hostname2

参考

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?