I got one problem with my linux webserver where I deployed from Virtual Machine template, usually i go to the console and then
issue the command hostname NEWSERVERNAME to make it happens and then followed by editing the file and its done, but how come this time after the reboot it reverts back to the old template name ?
so i want it to be "wordpress" as the hostname but instead it reverts back to SSV as the name ?
any suggestion and comments is appreciated here.
Thanks.
Usually, I change the hostname using the following commands WITHOUT REBOOT:
First, edit both files
/etc/hostname
to change the hostname, and edit/etc/hosts
to add the new name. Then, run the hostname script as shown above.All you need to do now is to terminate your current SSH session and reconnect to see the new host name.
Check /etc/hosts, /etc/hostname, and /etc/mailname. You may want to run
find /etc -type f | xargs grep $(hostname)
to list all references.In Debian and Ubuntu (which looks like the distribution you're using) to make your hostname stick through reboots, set it by editing the
hostname
file:Then make sure that your VPS hosting company will not override your hostname configuration via DHCPCD. In
/etc/default/dhcpcdp
ensure that theSET_HOSTNAME
directive is commented out or it is set to 'no':After rebooting your chosen hostname has to be active (you can also set it in that same session before rebooting with
hostname -F /etc/hostname
if you wish).$sudo vim /ect/hotname change what you want to use :)
I believe the default is set in the
/etc/HOSTNAME
file.