Linux – Change hostname on SUSE Linux Enterprise Server 11 SP3 for VMware

command lineconfigurationlinuxopensusesuse

I want to update the hostname for one of my VMware virtual machines running SUSE Linux Enterprise Server 11 SP3 for VMware .

I tried changing the hostname using YaST but after reboot the old name came back.

I tried echo "newhostname > /etc/HOSTNAME" but after reboot this also goes.

I also tried hostname newhostname but this was also lost after reboot.

How can I make the change permanent?

Best Answer

To change the hostname on a SUSE system you need to change the following files:

  • /etc/HOSTNAME
  • /etc/hosts

You may also have other configuration files where it's stored (e.g., postfix configuration files), so a grep -R for the old hostname in /etc is probably a good idea:

grep -R <oldhostname> /etc

where <oldhostname> is the old hostname).

Related Question