How do I set the hostname on Rocky Linux?

Im going total nuts here.
I change my server hosting location from Finland to Germany (Both Hetzner) and try to install Virtualmin on Rocky again…
Now I run into problems with the SSL cert for the server.
Befor I run the Virtualmin install.sh the hostname was “server”, the FQDN was “server.o-arp.de”.
After the installer was done the hostname is “server.o-arp.de” and the FQDN is “server.o-arp.de”.

I restored an Image of the server without Virtualmin installed. Checked the Hostname.

cat /etc/hostname -> server
hostname -> server
hostname -f -> server.o-arp.de
hostnamectl -> server

I also check with nmtui.
Then I added

195.201.221.161 server.o-arp.de server

to /etc/hosts.
But as soon as the Virtualmin installer reaches “Phase 2 of 4: Setup” the hostname changes to server.o-arp.de.

DNS record of server.o-arp.de points to the right IP.
ReserveDNS for the IP also points to the right FQDN.

Why does Virtualmin installer changes the hostname to FQDN?
I fell so stupid!

This is exactly what *min requires to operate (cf. section " Fully qualified domain name"):

Hello,

In my opinion, the problem lies in the configuration file of cloud-init on VMs at /etc/cloud/cloud.cfg

Please replace

disable_root: false

&&

preserve_hostname: true

Then change hosts && hostname and reboot the VMs. I think everything will be resolved

File does not exists.
I installed via ISO image and not installimage.

ahhh… I installed too often!
Let’s encrypt has a limit.

But this dosent explain why hostname changes to FQDN.

Its need to be a FQDN to function correctly, its in the docs.

That’s not relevant to the problem SkaFan is describing. He is saying the name changed at some point unrelated to the install or what he set it to.

There is a step in the installer that allows the user to set an FQDN if one isn’t already set, but if the system has a FQDN when it runs, the installer does not alter the system hostname. Everything related to hostname is explicit, you know it is happening, when it is happening, and why, which does not match what SkaFan is describing, so it has nothing to do with Virtualmin or the installer.

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.