Changing Oracle Enterprise Linux hostname

Have you every been in the situation where corporate naming standards have changed and you have a bunch of systems where you need to change the hostname? This simple post provides the steps necessary to do just that for Oracle Enterprise Linux systems

In this scenario, the powers-of-be wanted a 2-digit year suffix to all hostnames for the actual year the system was build, so my hostnames are changing from:

OldNew
jupiter jupiter11
mars mars09
mercury mercury11
saturn saturn10

Under Oracle Enterprise Linux the current hostname is generally stored in two places

  • /etc/sysconfig/network
  • /etc/hosts

Old jupiter hostname:

# hostname
jupiter

So to make the changes for the new hostname, we perform:

  1. Edit /etc/sysconfig/network and change
    HOSTNAME=jupiter
    to
    HOSTNAME=jupiter11
  2. Edit /etc/hosts, and change:
    10.1.1.12 jupiter
    to
    10.1.1.12 jupiter11
  3. Proof is in the pudding:
    # hostname
    jupiter11

We could simply use hostname -b to perform the task, but the above would probably work across different Linux releases

warning: Whist change the hostname is pretty simple, you may need to check any applications or services that utilise the machine to confirm that any hardcoded hostname entries are also changed.