sudo sysctl kernel.hostname=newHostname
Above change will be gone once server is restarted. To permanently change the hostname follow the steps below:
→ sudo su [If not already a sudoer] → nmtui [This will prompt the gui, select the hostname and change to newHostname] → restart the server