Skip to main content
Help Center
The GoDaddy Community will undergo maintenance starting on Tuesday, August 3rd at 3pm PST / 6pm EST. Learn more
  • GoDaddy Community
  • VPS & Dedicated Servers
  • VPS & Dedicated Servers

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 
    Go to solution
    AdmNash
    New

    Self-managed Linux VPS and Hostname

    Hello,

    I just my VPS, and trying to configure it my production server, but before I move on I like to change the hostname, but I didn’t get any documentation about the VPS other than IP, and relay host.

    Anyone know if allowed to change the host name from

    ip-xxx-xxx-xxx-xxx.ip.secureserver.net

    to

    something more reasonable like

    server1.mydomain.com

     

    I think the name ip-xxx-xxx-xxx-xxx.ip.secureserver.net will not be good for auto generated ssl name, email client will keep asking to use that certificate, I tried that.

     

    Thanks   

    1 ACCEPTED SOLUTION
    PL281
    Super User IV

    @AdmNash 

     

    You didn't mention if you are using WHM/cPanel on the server. I've provided some instructions below - please note - that if you do this via the command line  to be VERY careful as you can crash your entire server if you not careful.

     

    Also note that the default host does not auto generate an SSL certificate.

     

    If you are then....

    1. Log into your WHM as the root user.
    2. Type ‘host‘ into the WHM search field.
    3. Click on the option Change Hostname under the section Networking Setup.
    4. Under the section Change Hostname, enter the hostname desired in the New Hostname: field.
    5. Click the Change button.

     

     

    If not then...

     

    A computer hostname represents a unique name that gets assigned to a computer in a network in order to uniquely identify that computer in that specific network. A computer hostname can be set to any name you like, but you should keep in mind the following rules:

    • hostnames can contain letters (from a to z).
    • hostnames can contain digits (from 0 to 9).
    • hostnames can contain only the hyphen character ( – ) as special character.
    • hostnames can contains the dot special character ( . ).
    • hostnames can contain a combination of all three rules but must start and end with a letter or a number.
    • hostnames letters are case-insensitive.
    • hostnames must contains between 2 and 63 characters long.
    • hostnames should be descriptive (to ease identifying the computer purpose, location, geographical area, etc on the network).

    In order to display a computer name in CentOS 7 and RHEL 7 systems via console, issue the following command. The -s flag displayed the computer short name (hostname only) and the -f flag displays the computer FQDN in the network (only if the computer is a part of a domain or realm and the FQDN is set).

    # hostname
    # hostname -s
    # hostname -f

    Check Hostname in CentOS 7

    You can also display a Linux system hostname by inspecting the content of /etc/hostname file using the cat command.

    # cat /etc/hostname

    Display CentOS 7 Hostname

    In order to change or set a CentOS 7 machine hostname, use the hostnamectl command as shown in the below command excerpt.

    # hostnamectl set-hostname your-new-hostname
    

    In addition to hostname command you can also use hostnamectl command to display a Linux machine hostname.

    # hostnamectl

    In order to apply the new hostname, a system reboot is required, issue one of the below commands in order to reboot a CentOS 7 machine.

    # init 6
    # systemctl reboot
    # shutdown -r

    Set CentOS 7 Hostname

    A second method to setup a CentOS 7 machine hostname is to manually edit the /etc/hostname file and type your new hostname. Also, a system reboot is necessary in order to apply the new machine name.

    # vi /etc/hostname

    A third method that can be used to change a CentOS 7 machine hostname is by using Linux sysctl interface. However, using this method to change machine name results in setting-up the machine transient hostname.

    The transient hostname is a special hostname initialized and maintained only by the Linux kernel as an auxiliary machine name in addition to he static hostname and doesn’t survive reboots.

    # sysctl kernel.hostname
    # sysctl kernel.hostname=new-hostname
    # sysctl -w kernel.hostname=new-hostname

    To display machine transient hostname issue the below commands.

    # sysctl kernel.hostname
    # hostnamectl

    Change CentOS 7 Hostname

    Finally, the hostnamectl command can be used to achieve the following hostname setups: –pretty, –static, and –transient.

     

    I am a GoDaddy End User - Just Like You
    Check out my site! | I currently manage over 300 WordPress Websites
    * Please note that I offer free advice on this forum. Thank You Info If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

    Once your issue is resolved,
    please be sure to come back and click accept for the solution

    Get Better Support on the Community Boards!
    Etiquette When Asking for Help from the Community

    View solution in original post

    2 REPLIES 2
    PL281
    Super User IV

    @AdmNash 

     

    You didn't mention if you are using WHM/cPanel on the server. I've provided some instructions below - please note - that if you do this via the command line  to be VERY careful as you can crash your entire server if you not careful.

     

    Also note that the default host does not auto generate an SSL certificate.

     

    If you are then....

    1. Log into your WHM as the root user.
    2. Type ‘host‘ into the WHM search field.
    3. Click on the option Change Hostname under the section Networking Setup.
    4. Under the section Change Hostname, enter the hostname desired in the New Hostname: field.
    5. Click the Change button.

     

     

    If not then...

     

    A computer hostname represents a unique name that gets assigned to a computer in a network in order to uniquely identify that computer in that specific network. A computer hostname can be set to any name you like, but you should keep in mind the following rules:

    • hostnames can contain letters (from a to z).
    • hostnames can contain digits (from 0 to 9).
    • hostnames can contain only the hyphen character ( – ) as special character.
    • hostnames can contains the dot special character ( . ).
    • hostnames can contain a combination of all three rules but must start and end with a letter or a number.
    • hostnames letters are case-insensitive.
    • hostnames must contains between 2 and 63 characters long.
    • hostnames should be descriptive (to ease identifying the computer purpose, location, geographical area, etc on the network).

    In order to display a computer name in CentOS 7 and RHEL 7 systems via console, issue the following command. The -s flag displayed the computer short name (hostname only) and the -f flag displays the computer FQDN in the network (only if the computer is a part of a domain or realm and the FQDN is set).

    # hostname
    # hostname -s
    # hostname -f

    Check Hostname in CentOS 7

    You can also display a Linux system hostname by inspecting the content of /etc/hostname file using the cat command.

    # cat /etc/hostname

    Display CentOS 7 Hostname

    In order to change or set a CentOS 7 machine hostname, use the hostnamectl command as shown in the below command excerpt.

    # hostnamectl set-hostname your-new-hostname
    

    In addition to hostname command you can also use hostnamectl command to display a Linux machine hostname.

    # hostnamectl

    In order to apply the new hostname, a system reboot is required, issue one of the below commands in order to reboot a CentOS 7 machine.

    # init 6
    # systemctl reboot
    # shutdown -r

    Set CentOS 7 Hostname

    A second method to setup a CentOS 7 machine hostname is to manually edit the /etc/hostname file and type your new hostname. Also, a system reboot is necessary in order to apply the new machine name.

    # vi /etc/hostname

    A third method that can be used to change a CentOS 7 machine hostname is by using Linux sysctl interface. However, using this method to change machine name results in setting-up the machine transient hostname.

    The transient hostname is a special hostname initialized and maintained only by the Linux kernel as an auxiliary machine name in addition to he static hostname and doesn’t survive reboots.

    # sysctl kernel.hostname
    # sysctl kernel.hostname=new-hostname
    # sysctl -w kernel.hostname=new-hostname

    To display machine transient hostname issue the below commands.

    # sysctl kernel.hostname
    # hostnamectl

    Change CentOS 7 Hostname

    Finally, the hostnamectl command can be used to achieve the following hostname setups: –pretty, –static, and –transient.

     

    I am a GoDaddy End User - Just Like You
    Check out my site! | I currently manage over 300 WordPress Websites
    * Please note that I offer free advice on this forum. Thank You Info If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

    Once your issue is resolved,
    please be sure to come back and click accept for the solution

    Get Better Support on the Community Boards!
    Etiquette When Asking for Help from the Community

    View solution in original post

    Thank you for your reply, and sorry for not being clear in my question, no there is no cPanel, just Ubuntu 18.4, I’m managing it manually , thanks again for commands, I know how to change it,

    My question basically was if anyone knows if there are any restrictions to change the host name on VPS, because no documentation or  directions from Godaddy on what can I do or not. But looks no restrictions , thank you