The hostname on your machine will need to be set correctly. For rDNS requests your hostname must be an FQDN (fully qualified domain name) and have an A record. To change hostname or update your hostname login as the root user to your CentOS VPS Server. So you have two options. By using the automated hostnamectl set-hostname command or edit the files manually.
Change Hostname Automatically
As the root user or, a user with root privileges issue the following command. Update as required to change your hostname automatically.
hostnamectl set-hostname uk-command.f2h.cloud
reboot
Manually Update Hostname
To manually make modifications to the hostname assigned to your Discovery Instance we must edit a number of files. You should only need to do this if the first option doesn’t work.
So to get started. Open up the network file and set the hostname of the server in the HOSTNAME- variable. A hostname must always contain at least two (.) One before your domain and one or two with your TLD. For example, server.domain.com.
nano /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=server.first2host.co.uk
GATEWAY=213.186.XX.254
So, just modify the server.first2host.co.uk variable to the hostname you require then save that file.
Edit The /etc/hosts file
nano /etc/hosts
Inside the host’s file you will see a block of text like this;
127.0.0.1 localhost.localdomain localhost
213.186.XX.XX ns1.first2host.co.uk
Modify the last line to the required hostname and make sure the correct IP is listed. This should be your VPS Servers IP. Save that file. Reboot your machine and your hostname should now be changed. You can check this by just issuing the hostname -f command in an ssh console.
hostname -f
How was this article?
You might also like
More from Dedicated Servers
Cloud-init Modules That Automate and Customize Deployments
Cloud-init is a popular way to automate deployments of instances in a cloud or none cloud environment. To save having …
Install Ioncube Loaders In Ubuntu, Debian, CentOS and AlmaLinux
Ioncube Loaders are a piece of software that is used to protect the underlying code in PHP applications. Its aim …
Take Rdiff-Backup incremental backups of data in Linux Servers
Taking backups of your data in Linux is likely one of the most important things you can do. No one …