Cara mengganti hostname VPS Google CLoud Platform (GCP)

Berikut cara mengganti hostname pada VPS atau VM instance pada Google Cloud Platform (GCP). Akes SSH ke server dan ikuti perintah berikut:

Sebagai contoh hostname di sini akan saya set ke server.idnetter.com, silahkan diganti

hostnamectl set-hostname server.idnetter.com

Kemudian

nano /etc/hosts

Ganti baris yang ada # Added by Google, contoh

10.148.0.2 vm-instace-idnetter.south vm # Added by Google

menjadi

10.148.0.2 server.idnetter.com server # Added by Google

Kemudian pindahkan script google agar hostname tidak otomatis diset oleh google

mkdir /root/script_google_backup/
mv /etc/dhcp/dhclient.d/google_hostname.sh /root/script_google_backup/
reboot

Cek hostname

hostname

Hasilnya

server.idnetter.com

Selesai.

2 thoughts on “Cara mengganti hostname VPS Google CLoud Platform (GCP)

  1. Jasmanto Hermawan

    Terimakasih, udah 2 jam gak nemu solusi.
    Btw, di Debian 10 lokasinya ada di /etc/dhcp/dhclient-exit-hooks.d/google_set_hostname link ke /usr/bin/google_set_hostname

    1. Omar

      Thanks tambahannya mas @Jasmanto Hermawan.
      Untuk kawan-kawan yang pakai Debian 10:

      unlink /usr/bin/google_set_hostname
      mv /etc/dhcp/dhclient-exit-hooks.d/google_set_hostname /tmp/

      Kemudian reboot.

Add a comment