Cart

/ Domain name

/ Your .CO.UK domain
for only £ 4.99**

Get started with your own domain names

Register now

/ Other

/ Latest news

Launch of new Big Storage platform

Read more
Need help?

    Sorry, we could not find any results for your search querry.

    Changing your hostname in CentOS 7

    It is important to set a correct hostname on your VPS. The hostname is used by many applications to identify themselves on a network / the internet. Therefore, an incorrectly configured hostname can cause unexpected problems.


    Checking the hostname

     

    The current hostname can be retrieved with the command:

    hostname

    Or for more extensive information use the command:

    hostnamectl

    Changing the hostname

     

    There are three methods to customize or view your hostname:

    • thehostnamectl-command
    • the/etc/hosts-file
    • thehostname-command

    Only the changes of the first two remain intact after a restart. You change your hostname with these options as follows:
     

    • Hostnamectl:
      Use the command below and replace server.yourdomain.com with your desired hostname:
    hostnamectl set-hostname server.yourdomain.com

     

    • /etc/hosts:
      Open the /etc/hosts file with a text editor, for example:
    nano /etc/hosts
    • The second line looks like this:
    127.0.1.1          server.yourdomain.com  server
    
    • On this line, change server.yourdomain.com to the new hostname and replace ‘server’ with what is in front of yourdomain.com.

      Then save your changes (ctrl + x> y> enter) and restart your VPS.

    If you have not yet set a hostname, instead of the above example, you will see a placeholder with IP information, which looks like 123-123-123-123.colocation.transip.us

    • hostname:
      Use the command below and replace server.yourdomain.com with your desired hostname:
    hostname server.yourdomain.com
    • Please note that with the hostname command, the changes do not persist after a reboot of your VPS.

     

    Should you have any questions left regarding this article, do not hesitate to contact our support department. You can reach them via the ‘Contact Us’ button at the bottom of this page.

    Was this article helpful?


    Provide feedback about this article

    Need help?

    Receive personal support from our supporters

    Contact us