Oracle 给每个 ACE 一个福利,就是在 Oracle Cloud 上有 6500刀的消费券,可以直接在上面来买云主机用,正好弄了几个做测试机器。
但是发现实例修改主机名后,会有自动还原回来:
[root@instance-20250723-2205 ~]# hostnamectl set-hostname dave
这里修改 OCI 的Hostname 配置文件
vi /etc/oci-hostname.conf
将其中的 PRESERVE_HOSTINFO=0 修改为 PRESERVE_HOSTINFO=1
[root@dave ~]# cat /etc/oci-hostname.conf
# This configuration file controls the hostname persistence behavior for Oracle Linux
# compute instance on Oracle Cloud Infrastructure (formerly Baremetal Cloud Services)
# Set PRESERVE_HOSTINFO to one of the following values
# 0 -- default behavior to update hostname, /etc/hosts and /etc/resolv.conf to
# reflect the hostname set during instance creation from the metadata service
# 1 -- preserve user configured hostname across reboots; update /etc/hosts and
# /etc/resolv.conf from the metadata service
# 2 -- preserve user configured hostname across instance reboots; no custom
# changes to /etc/hosts and /etc/resolv.conf from the metadata service,
# but dhclient will still overwrite /etc/resolv.conf
# 3 -- preserve hostname and /etc/hosts entries across instance reboots;
# update /etc/resolv.conf from instance metadata service
PRESERVE_HOSTINFO=1
[root@dave ~]#
然后在修改就不会变了。
版权声明:本文为博主原创文章,未经博主允许不得转载。