Changing the Hostname

Hello, OVH Community.

I've got a brand new VPS and I'm setting everything up.

However, I've found myself in a little trouble, when trying to rename my VPS' hostname.

I've followed the following steps:

1. Follow this guide and edit the `/etc/cloud/cloud.cfg` file, adding and changing the following lines:

```
preserve_hostname: true
manage_etc_hosts: false
```

2. Use the `hostnamectl` command as follows:

```
hostnamectl set-hostname subdomain.domain.tld
```

3. Edit the `/etc/hosts` file accordingly.

However, after a reboot, if I access the `/etc/hosts` file, it preserves all the changes, but keeps adding the following line:

```
127.0.1.1 vps-XXXXXXXX.vps.ovh.net vps-XXXXXXXX
```

What is the precise procedure to rename your virtual private server?

Regards.

Hi,

  1. comment out the '-update_etc_hosts' parameter in the '/etc/cloud/cloud.cfg' file .
  2. Use the `hostnamectl` command as follows: hostnamectl set-hostname [hostname.domain]
  3. edit the `/etc/hosts`

that's how it works for me.

Tested on almalinux and centos.