Hostname change procedure on CentOS / Ubuntu

Open the terminal or login to the remote server using ssh client. Edit /etc/sysconfig/network file, enter:

# vi /etc/sysconfig/network

Find and modify HOSTNAME value to set to FADN such as inetxxx.inetservices.com:

Hostname=”inetxxx.inetservices.com”

Save and close the file.

 

Edit hosts file

Edit /etc/hosts file, enter:
# vi /etc/hosts
You need to set or change the host that is set to your IP address on server.

127.0.0.1 localhost
192.168.x.x

Edit hosts file

Edit /etc/hosts file, enter:
# vi /etc/hosts
You need to set or change the host that is set to your IP address on server.

127.0.0.1 localhost
192.168.x.x inetxxx.inetservices.com inetxxx

Save and close the file.

Set hostname manually without rebooting the box

Type the following command:
# hostname inetxxx.inetservices.com

Restart the CentOS / Ubuntu networking and other services (if any)

You need to restart the networking service on CentOS / Ubuntu Linux, enter:
# service network restart
OR
# /etc/init.d/network restart

Verify new hostnames

Simply type the following commands:
# hostname

Save and close the file.

Set hostname manually without rebooting the box

Type the following command:
# hostname inetxxx.inetservices.com

Restart the CentOS / Ubuntu networking and other services (if any)

You need to restart the networking service on CentOS / Ubuntu Linux, enter:
# service network restart
OR
# /etc/init.d/network restart

Verify new hostnames

Simply type the following commands:
# hostname

Leave a Reply

Your email address will not be published. Required fields are marked *