Changing Your Pi's Hostname
To change your Pi's hostname permanently you need to edit the configuration file /etc/hostname.
At the Pi command line, enter the following command.
sudo nano /etc/hostname
Change the current name to the new name and save your changes.
Now you need to make the change active; do this by running the startup script that sets the hostname:
sudo /etc/init.d/hostname.sh start
When the Pi is rebooted its hostname will persist.