Set Hostname on CentOS

Step 1: Log In To Your VPS

Locate the IP address of your AKLWEB HOST VPS and log in as the root user.

ssh root@server

Step 2: Use The Hostname Utility

Change your hostname to a different name of your choosing. For example:

hostname server01

Step 3: Edit /etc/hosts

Open the /etc/hosts file with your favorite text editor. For example:

nano /etc/hosts

Change the first line and replace your old hostname with the new one. Save the file and exit the editor.

Step 4: Edit /etc/sysconfig/network

This file also contains your hostname. Open the /etc/sysconfig/network file with your favorite text editor.

Change HOSTNAME=akl-web-host to your desired hostname. For example: HOSTNAME=server01.

Step 5: Check Your Hostname

Run the following command to check your new hostname:

hostname

The new hostname will be displayed in your SSH terminal.

We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies

More