• Home
  • Tutorials
  • Development Tools
  • Contact Us

Developing Software

Mastering Software Craftsmanship

Installing x11vnc on Raspbian, and Connecting to Raspberry Pi with VNC Viewer

9th March 2015 by @developingsoft

If your Raspberry Pi does not have a mouse and keyboard connected, or it’s in a different room. You will want to configure x11vnc so that you can connect to the primary X11 session with VNC Viewer. This post will show you how.

Connected to Raspberry Pi  with VNC Viewer

Install x11vnc

Fire up a terminal and run the following command:

sudo apt-get install x11vnc

Run x11vnc for the first time

Run the following command to start x11vnc for the first time:

x11vnc -forever -usepw -display :0

Because we have specified the -usepw switch you will be asked to enter a password. This will be the password required by clients when connecting to the Pi.

You should now be able to connect to the Pi using a VNC Viewer client.

Make x11vnc start on boot

If you want to run x11vnc all the time, and start it when the Pi boots up, you will need to create an autostart file. Run the following commands to create the autostart file:

cd .config
sudo mkdir autostart 
cd autostart
sudo vim x11vnc.desktop

Paste the following text into the file:

[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=X11VNC
Comment=
Exec=x11vnc -forever -usepw -display :0
StartupNotify=false
Terminal=false
Hidden=false

Save the file and then reboot the Pi:

sudo reboot

Connecting to the Raspberry Pi with Real VNC Viewer

You should now be able to connect to the Pi using your favorite VNC Viewer. The image below shows a connection using Real VNV Viewer on Windows 8.1.

Connected to Raspberry Pi  with VNC Viewer

In the example above, I am connecting to a Raspberry Pi that has a static IP address assigned of 192.168.1.1. The :0 appended to the address tells VNC to connect to the main X11 session.

Once connected you should be able to see, and control what is displayed on the display connected to the Raspberry Pi.

Share this on:

Filed Under: Tutorials Tagged With: Raspberry Pi

Search

Advertisement

Newsletter

Subscribe now to receive practical tips on how to become a better software developer.

Free - No Spam - 100% Email Privacy

Featured Posts

Abstract Factory Pattern: C# Example Using the Unity Game Engine

23 Software Design Patterns That Will Make You a More Effective Programmer

How to Deploy an ASP.NET Core Website to Ubuntu with Git

How to Run an ASP.NET Core Website in Production on Ubuntu Linux

How to Install the Edimax Wireless nano USB Adapter on Windows IoT Core for Raspberry Pi

How to Convert a Post Title into a Friendly URL (Slug) in C#

How to Convert Markdown to HTML in ASP.NET Core

How to Send an E-Mail with ASP.NET Core and Mailgun

How to Generate a Sitemap in ASP.NET MVC and ASP.NET Core

How to Create an MD5 Hash of a String in C# and Displaying a Gravatar Image

© 2014–2023 Developing SoftwareTerms • Privacy