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.
Changing the Hostname
Related questions
- Public cloud for OpenStack-native project
3916
02.01.2025 11:53
- port forwarding on floating ip
3670
11.03.2024 16:49
- Additional IP in routed mode on public network interfaces
3167
10.08.2023 15:37
- Server Standard Gateway
3118
18.02.2022 13:43
- VPN with Dedicated Servers
2646
10.07.2023 11:20
- Is upgrading my plan or RAM seamless?
2639
21.11.2022 11:11
- Terraform Virtual Private Servers
2546
17.07.2023 14:25
- Upgrade Windows Server 2012 R2 to Windows Server 2022
2180
26.06.2023 07:23
- Request for hardware; Raspbian, preferably on rPi.
1757
11.06.2025 08:22
Hi,
that's how it works for me.
Tested on almalinux and centos.