I know that to update the hostname
of an AWS EC2 instance, I have to update /etc/sysconfig/network
and then do a reboot
.
But I need to do it without the reboot, is there a way to do this? I know that in some Linux distributions, you just need to source
certain files to do this, but I cannot find what needs to be sourced in case of Amazon Linux.
Also, the updated hostname should be persistent, as in it should stay after restarts.
Thanks.
Best Answer
You can also edit
/etc/hostname
to have the desired hostname, and then runto apply the hostname from that file to the system.
See
hostname --help
for more options.