Montag, 28. Juli 2014

Change the Raspberrypi hostname

I'm currently creating my on control system for two of my electric roller shutters.
They will be time controlled, maybe have a light sensor and two physical buttons to control them. But more important: There will be a webinterface to move them up and down and to set the times for the shutters to go down or up.
Since I use multiple raspberry pis in my house and also wanted a logical hostname to access the pi, I needed to change the hostname of the pi.
To do this you need to edit two files:

1. /etc/hostname
This file contains only one line with the hostname. The default with Raspbian should be raspberrypi, so edit it to whatever your new name should be. (Remember: You need root access to edit these files, so you have to use sudo nano /etc/hostname for example!)

2. /etc/hosts
This file has multiple lines. The interesting part for us is the last line:      raspberrypi
Change raspberrypi to the exact same hostname you used for the first file and you are good to go!
Restart your Pi and from now on you should be able to access it with your new name.

Keine Kommentare:

Kommentar veröffentlichen