Learn Set Hostname on CentOS
Table of Contents
- Step 1: Login to your VPS
- Step 2: Use the hostname utility
- Step 3: Edit /etc/hosts
- Step 4: Edit /etc/sysconfig/network
- Step 5: Check your hostname
- Step 6: (Optional) Change reverse DNS
Step 1: Login to your VPS
Locate the IP address of your IT Web Services VPS and login as the root user.
Step 2: Use the hostname utility
Change your hostname to a different name of your choosing. For example:
Step 3: Edit
/etc/hosts file with your favorite text editor. For example:
Change the first line and replace your old hostname with the new one. Save the file and exit the editor.
Step 4: Edit
This file also contains your hostname. Open the
/etc/sysconfig/network file with your favorite text editor.
HOSTNAME=itweb.services to your desired hostname. For example:
Step 5: Check your hostname
Run the following command to check your new hostname:
The new hostname will be displayed in your ssh terminal.
Step 6: (Optional) Change reverse DNS
Visit https://my.itweb.services.com/, then navigate to your VPS. Click on the IPv4 tab. You will see an “Update” button in the “Reverse DNS” column. Click this button to update the reverse DNS address. By default it will read:
It is common to replace
x.x.x.x.itweb.services.com with the DNS name of your server, which may be related to its hostname.
Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!