Changing Your Pi's Hostname

The recommended way to change you Pi's hostname is to use raspi-config.

At the Pi command line, enter the following command.

sudo raspi-config

and follow the prompts. When the Pi is rebooted its hostname will persist.