On this page
- What is the difference between a label and a hostname?
- How do you set both when deploying?
- How do you rename a label later?
- Where does the console show the hostname?
- How do you check and change the hostname on Linux?
- Why does /etc/hosts need a matching line?
- Does the hostname need DNS records too?
- What if the hostname resets after a reboot?
- What naming habits keep a fleet manageable?
- Questions
What is the difference between a label and a hostname?
They answer different questions. The label tells you which server is which in the console: it is the bold name in the Instances list, the heading of the server page, and the name shown in the confirmation dialogs for actions like Reinstall or Destroy. It can contain spaces and any characters, up to 60 of them, and it never reaches the server.
The hostname is part of the operating system. It shows in your shell prompt, in log lines, in mail headers, and in what monitoring tools report. It must follow DNS naming rules, and when it is a full domain name (an FQDN such as app1.example.net) other software may use it to build URLs or identify the machine.
How do you set both when deploying?
On the Deploy page, the Server settings step has two fields side by side:
- Hostname: lowercase letters, digits, hyphens and dots, each dot-separated part starting and ending with a letter or digit. Capitals you type are turned into lowercase. Left empty, the console creates one from the image and the city code plus four random characters, for example
ubuntu-sgp-7k2m, or the app name and city for one-click apps. - Label: anything up to 60 characters. Left empty, it copies the hostname, as the placeholder Same as hostname says.
A practical pattern is a short role and number for the hostname, such as web1.example.net, and a label that adds what the console cannot see, for instance Shop web 1, Frankfurt, client B. The rest of the order steps are in deploy a server.
How do you rename a label later?
Open the server from Instances, choose the Settings tab, edit the text in the Label box and press Save. A short Saved message confirms it, and the new name shows in the list and on the server page right away. Renaming a label changes nothing on the server and does not restart it.
Labels are worth keeping tidy once you run more than two or three servers, because the Instances list, the support ticket form (under Related invoice or server) and the confirmation dialogs all identify servers by label. A clear label is the cheapest protection against destroying the wrong machine.
Where does the console show the hostname?
The hostname chosen at deploy appears on the Overview tab, under the root password and image, and on the invoice for the order. The console has no field to change it afterwards: that is done inside the operating system, as shown below. If you change it on the server, the Overview tab keeps showing the original value, so use the label to record the current role if they drift apart.
How do you check and change the hostname on Linux?
The same commands work on Ubuntu, Debian, Rocky Linux and AlmaLinux, since all of them use systemd. Look at the current values first:
hostnamectl\nhostname\nhostname -fThen set the new name. Using the full domain name is common for servers that send mail or run services that identify themselves:
sudo hostnamectl set-hostname app1.example.net\nhostnamectl statusThe change takes effect at once for new shells; log out and back in to see it in your prompt. It is stored in /etc/hostname and survives reboots. A wider walkthrough is in change the hostname.
Why does /etc/hosts need a matching line?
Programs that look up the machine's own name, including sudo and many mail and database tools, expect it to resolve locally. If it does not, you may see a warning such as unable to resolve host, or a delay of a few seconds on each sudo. Fix that with a line in /etc/hosts.
On Ubuntu and Debian, the convention is the address 127.0.1.1 with the full name first and the short name after it:
127.0.0.1 localhost\n127.0.1.1 app1.example.net app1\n::1 localhost ip6-localhost ip6-loopbackOn Rocky Linux and AlmaLinux, add the names to a line of their own, or map them to the public address if your software needs the real IP:
198.51.100.24 app1.example.net app1Edit with sudoedit /etc/hosts, then confirm:
hostname -f\ngetent hosts app1.example.nethostname -f should print the full name.
Does the hostname need DNS records too?
For an FQDN that other machines should reach, yes. The hostname on the server does not publish anything by itself. Create an A record for the IPv4 address and an AAAA record for IPv6 at your DNS provider, as covered in DNS records. Then check from outside:
dig +short app1.example.net A\ndig +short app1.example.net AAAAWhen the name will send mail, ask support for reverse DNS on the address so that it points back to the same FQDN; the steps are in your server IP addresses.
What if the hostname resets after a reboot?
Some images let a first-boot tool rewrite the hostname at each start. Check for its config file and, if it exists, tell it to keep yours:
ls /etc/cloud/cloud.cfg 2>/dev/null && grep -n preserve_hostname /etc/cloud/cloud.cfgIf the file is there, set the option and reboot to test:
echo 'preserve_hostname: true' | sudo tee /etc/cloud/cloud.cfg.d/99-keep-hostname.cfg\nsudo systemctl rebootAfter the reboot, hostnamectl should still show your chosen name. If the file is not there, nothing rewrites the name, and /etc/hostname alone decides it.
What naming habits keep a fleet manageable?
A few conventions pay off as servers multiply:
- Use a pattern for hostnames: role, number, and optionally the city code, such as
db2-fra.example.net. - Never reuse the hostname of a destroyed server for a different role while old DNS records or monitoring entries still point to it.
- Put the purpose and owner into the label, since it accepts spaces and is free text.
- Keep the prompt informative: the hostname in your shell prompt is a last warning before running a command on the wrong server.
Questions about Labels and hostnames
Can I change the hostname from the console after deploy?
No. Only the label can be changed in the console, under Settings. Change the hostname on the server with hostnamectl.
Does changing the label restart the server?
No. The label exists only in the console and the change is saved instantly.
Can a label contain spaces?
Yes. A label is free text up to 60 characters. The hostname cannot contain spaces.
What hostname do I get if I leave the field empty?
One built from the image and the city code plus four random characters, for example ubuntu-sgp-7k2m. One-click apps use the app name and the city.
Why does sudo say unable to resolve host?
The hostname has no entry in /etc/hosts. Add a line with the full and short name, then run hostname -f to confirm.
Does the hostname have to be a real domain?
No. A short name such as web1 works. Use a full domain name when other machines or mail servers need to reach or identify the server by name.
More in Your server and account
- Deploy a server from the console
- Connect with PuTTY on Windows
- Restart, stop and start a server
- Destroy a server you no longer need
- Manage SSH keys in the console
- Your account key and sign-in
- Pay an invoice with crypto
- Renewals, pauses and removal
- Open and follow support tickets
- Your server IPv4 and IPv6 addresses