Being able to SSH into the RaspberryPi is good but what if you wanted to log into the GUI of the RaspberryPi? This is good if you have to view pictures and a few other things. What TightVNC does is creates a remote desktop environment on your RaspberryPi. One real advantage to this is you can log in, open up the terminal, run a program, log out of the TightVNC, and the program will still run! I have done this many times in the past where I would compile a program that takes a few hours as well as set up a quick motion detection program straight from my iPad or phone! This saves the trouble if you are running headless to hook up a monitor and keyboard. You can also do this over SSH with the
|pi@raspberrypi ~ $ screen|
command but I feel more confident with the VNC server.
To start we will install the program with:
|pi@raspberrypi ~ $ sudo apt-get install -y tightvncserver|
Once it is done installing we will set it up with:
|pi@raspberrypi ~ $ tightvncserver|
It will ask you to enter a password for the server and optionally a password for viewing only. I did both and wrote them down in my log.
And that’s it!
To start a session you can run the following command:
|pi@raspberrypi ~ $ vncserver :0 -geometry 1920×1080 -depth 24|
:0 (That’s a zero) is the session ID. You can have multiple sessions if you’d like
-geometry 1920×1080 is the resolution of the server. This can be changed to whatever best fits your screen, Often times I use 800×600 since it is also faster.
-depth 24 is the color quality (24 bit).
To stop a session you can run:
|pi@raspberrypi ~ $ vncserver -kill :0|
:0 (That’s a zero) is the session ID that you want to kill.
There are ways to make this auto load at boot and I will be talking about the easiest way to do it in my final post about setting up my RaspberryPi. The way I describe will make it very easy to disable that when it is not needed.
See you next time,