Via SSH as root:
hostnamectl set-hostname server.mydomain.com
after that check your /etc/hostname file to see if the hostname is in there, if not, adjust it.
After that check your /etc/hosts file to have it contain like this:
Code:
127.0.0.1 localhost
your.ip.ad.res server.mydomain.com
Reboot your server/vps and issue these commands check if they return the correct hostname.
hostname
and
hostname -f
both commands should give the full server.mydomain.com hostname as a result.
Then also change it in Directadmin.
Login as admin, go to DNS administration, check for the server-xx-xx-xx-xx.da.direct and delete it if present.
Then in DNS administration, create your new hostname like a domain.
You will have to fill in the server ip and the nameservers.
Now there is a bug, so login to SSH and go to the /etc/virtual directory and make sure that the directory server.mydomain.com is present in there too, if not created it and chown it to mail and chmod to 711.
chown mail. server.mydomain.com
chmod 711 server.mydomain.com
If you are using an external nameserver, be sure to create the appropriate A record for the hostname there too.
That might need a bit of time to sync, but after that your hostname should be working.
Additionally: Dont forget to create a new hostname certificate for your hostname, for example:
Code:
cd /usr/local/directadmin/scripts
./letsencrypt.sh request_single server.mydomain.com 4096
Also, be sure to have a valid rDNS/PTR record for your hostname. You can normally set this in the control panel of the one who gave you the server ip, so mostly datacenter control panel or panel of VPS provider.
=====================
Edit: Adjust the post a bit, changed "core.mydomain.com" to "server.mydomain.com" as hostname, so i can use this post better as example for others too.