I need help to setup the proper host name

taker18

Verified User
Joined
Oct 18, 2021
Messages
141
Location
USA

This is e-mail notification to warn you that your hostname is setup improperly on your system.​

"2022-02-02 18:10
Your hostname, snapshot-59081115-ubuntu-4gb-ash-1, and the server name you have set in DirectAdmin, server.hostname.com, do not match. It is recommended that these two values are the same.

Solution:

Either change the server name in DirectAdmin or run the 'hostname.sh' script via ssh to change your hostname"

I would like to mention that i restored my server from backup few days ago, but was able to upload files normally. now I need help with both the name of server as you see " snapshot-59081115-ubuntu-4gb-ash-1" and on direct admin panel is " server.hostname.com" also on my account client direct admin main site account i added "server.ulamainst.com" that where the licensed at the payment and that stuff. I am really confused about how to fix this. where should I add what?

Last edited: 7 minutes ago
Reply
 

Attachments

  • host name.png
    host name.png
    273.7 KB · Views: 267
Last edited:
I am really confused about how to fix this. where should I add what?
You're an admin right? It says the hostname does not match the one in your panel. Easy to find on Google. ;)

So the hostname of your OS is snapshot-59081115-ubuntu-4gb-ash-1 and that must be changed.

Try this from SSH:
sudo hostnamectl set-hostname server.ulamainst.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.ulamainst.com

Reboot your VPS and the issue should be gone.
 
Oh I see you just edited your post with a solution.

Yes that's also possible, I rather like to have it correct in alle the places I mentioned but that's a choice.
 
You're an admin right? It says the hostname does not match the one in your panel. Easy to find on Google. ;)

So the hostname of your OS is snapshot-59081115-ubuntu-4gb-ash-1 and that must be changed.

Try this from SSH:
sudo hostnamectl set-hostname server.ulamainst.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.ulamainst.com

Reboot your VPS and the issue should be gone.
Thank you @Richard G that was valuable, I did search but I couldn't come up find my answer or maybe I couldn't grasp it right. either way thank you for the help.
1- after running the command i found that /etc/hostname has the right hostname server.ulamainst.com Great
2- But when i checked at /etc/hosts I found
"127.0.1.1 snapshot-59081115-ubuntu-4gb-ash-1 snapshot-59081115-ubuntu-4gb-ash-1
127.0.0.1 localhost"
sound like I need to replace it with the correct host name server.ulamainst.com, correct?
3- inside the panel as you see in the snap shot how about server.hostname.com, N1 and N2 there something needs to be changes over there
 

Attachments

  • host name.png
    host name.png
    273.7 KB · Views: 132
when I run "sudo bin/hostname --fqdn"

sudo: unable to resolve host server.ulamainst.com: No address associated with hostname

sudo: bin/hostname: command not found
 
Check your /etc/resolv.conf and try setting it to use 127.0.0.1Unable to resolve your hostname, . This will cause major issues when sending email.
this is what i found
nameserver 127.0.0.53

options edns0 trust-ad
 
sound like I need to replace it with the correct host name server.ulamainst.com, correct?
You can leave those two, but I would add the host name like I wrote, with your ip adress:
192.168.0.10 server.ulamainst.com
but replace 192.168.0.10 with your main server ip which is used for the hostname.

Normally are ns1 and ns2 also filled in by directadmin. Normally the domain of your hostname, so like:
ns1.ulamainst.com
ns2.ulamainst.com

sudo: bin/hostname: command not found
just use:
hostname --fqdn
or
sudo hostname --fqdn
 
nameserver 127.0.0.53
I don't know where you got that, but I never use 127.0.0.53. I wouldn't use that one.
In /etc/resolv.conf should point to correct nameservers.

We use:
nameserver 127.0.0.1
nameserver 1.1.1.1
nameserver 2xx.xxx.xxx (datacenter nameserver)

You can also use like:
nameserver 127.0.0.1
nameserver 1.1.1.1
nameserver 8.8.8.8
 
I don't know where you got that, but I never use 127.0.0.53. I wouldn't use that one.
In /etc/resolv.conf should point to correct nameservers.

We use:
nameserver 127.0.0.1
nameserver 1.1.1.1
nameserver 2xx.xxx.xxx (datacenter nameserver)

You can also use like:
nameserver 127.0.0.1
nameserver 1.1.1.1
nameserver 8.8.8.8
127.0.0.53. this what i found inside /etc/resolv.conf.
 
Ah, seems something Ubuntu does mainly. Has to do with some connection with systemd-resolved. I don't use Ubuntu. Otherwise comment it out, if you get trouble, remove the comment again. :)
 
Ah, seems something Ubuntu does mainly. Has to do with some connection with systemd-resolved. I don't use Ubuntu. Otherwise comment it out, if you get trouble, remove the comment again. :)
I am using ubuntu indeed
 
so I got this email and

This is e-mail notification to warn you that your hostname is setup improperly on your system.​

2022-02-03 18:10
Cannot find your hostname using the command '/bin/hostname --fqdn'. Please check this command to ensure it works properly.
If you get the error:
hostname: Name or service not known

Check your /etc/resolv.conf and try setting it to use 127.0.0.1Unable to resolve your hostname, . This will cause major issues when sending email.

Solution:

Create an A record for your hostname (.) in your DNS control panel. Point the hostname to your server's main IP address. Also check /etc/hosts to ensure that the server ip is correctly set.
--

Thank you for great help so far and I did all as instructed by you.

now the final set
when i ssh /etc/resolv.conf I find :

nameserver 127.0.0.53
options edns0 trust-ad

sounds like there is something wrong here. so i need to replace 127.0.0.53 with 127.0.0.1 only or with all :
nameserver 127.0.0.1
nameserver 1.1.1.1
nameserver 8.8.8.8
should I do that change
 
Ah, seems something Ubuntu does mainly. Has to do with some connection with systemd-resolved. I don't use Ubuntu. Otherwise comment it out, if you get trouble, remove the comment again. :)
I am just curious if you are not using Ubuntu, which OS you are using? I would like to know. thank you
 
sounds like there is something wrong here. so i need to replace 127.0.0.53 with 127.0.0.1 only or with all :
I'm not sure as this is Ubuntu. In your case I would first try to add the things I mentioned.
Also doublecheck that /etc/hosts now has the correct entry too.

I'm using servers with Centos 7 and using servers with Alma Linux at the moment (the new servers) because Centos will stop.
If I would ever change, it would be Debian instead of Ubuntu because imho that's a little bit more stable.

But as said. I'm using Alma Linux for newer servers.
 
yes Ubuntu than Debian than Alma linux are my choices in order. I used to use Centus 7 and when I did the move to Direct admin recently from cyber panel. I decided to pick Ubuntu, because of its popularity. Thank you @Richard G for the help.
 
Be aware that Ubuntu can be slightly more unstable than Debian, it's popular because of desktop usage, but it will get updates sooner if I'm correct.

Anyway, as for my help, you're welcome!
 
Be aware that Ubuntu can be slightly more unstable than Debian, it's popular because of desktop usage, but it will get updates sooner if I'm correct.

Anyway, as for my help, you're welcome!
Totally agree with you the popularity is coming from the desktop, not the server, the preferred server is Debian or Centus 7, 8 and Alama linux.
 
Back
Top