How to assign a static hostname to a Paperspace Linux Instance
To be sure that the hostname persists when rebooting or stopping and starting your instance, add the hostname to the appropriate configuration files on your instance.
Use vim to open the /etc/hosts file.
sudo vim /etc/hosts
Update the /etc/hosts file to include your persistent hostname for localhost, similar to the following:
127.0.0.1 localhost persistent-hostname
You might have to create an entry for localhost if the /etc/hosts file on your Paperspace instance doesn't have an entry for it.
For more information about the hosts file on Ubuntu, see the Ubuntu 18.04 hosts file manpage.
Save and exit the vim editor.
After making this change, press SHIFT+:[colon] to open a new command entry box in the vim editor. Type wq, and then press Enter to save changes and exit vim. Or use SHIFT + ZZ to save and close the file.
Run the hostnamectl command and specify the new hostname. Replace the persistent-hostname with the new hostname.
sudo hostnamectl set-hostname persistent-hostname
After you start or reboot the Paperspace instance, run the Linux hostname command without any parameters to verify that the hostname change persisted.
The command returns the new hostname.
If you install any system updates that affect the /etc/hosts file, the hostname file, or the hostname utility, you must run these steps again.