Changing the Host Name on CentOS

I'm working on a project that is leveraging a third-party Java library to handle payment processing. This library is a for-pay product and the license is tied to the machine name, so the original license was being used on a local development box but now that we want to move things to the production server, the license wouldn't be valid since the production server's host name isn't the same as the local development box.

Apparently the company who sells the payment processing library can update the license file, but it seemed even easier to simply change the host name of the production server to match what the license is expecting. This way we can move the payment processing functionality to a different machine as needed without having to wait for a new license key to be issued.

The production server in this case is CentOS, so to change the host name you simply update /etc/sysconfig/network with the new host name and reboot.

This is slightly different from Ubuntu, which stores the host name in /etc/hostname. On Ubuntu you can also use the hostname command to change the hostname temporarily, but it will revert back to the value in /etc/hostname when you reboot.

3 thoughts on “Changing the Host Name on CentOS

Leave a Reply

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