Raspberry Pi and VNC

Source: Internet
Author: User
Tags syslog tightvnc

Sometimes it is not convenient to directly operate Raspberry Pi. You may want to use other computers to remotely control Raspberry Pi.


VNC is a graphical interface shared by the system. It allows you to remotely control the desktop interfaces of another computer. It sends keyboard and mouse events from the computer and receives screen updates from the remote computer over the network.


You will see Raspberry Pi's desktop in a window on your computer. You can perform the same operations on the desktop as directly controlling Raspberry Pi.


-Install the TightVNC package on your Raspberry Pi (using a monitor or using SSH:

sudo apt-get install tightvncserver

-Next, run the TightVNC service. It will prompt you to enter the password and an optional read-only password:

tightvncserver

-Start a VNC service on the terminal. In the following example, a full-screen HD resolution session with port (: 0) is started on VNC:

vncserver :0 -geometry 1920x1080 -depth 24

-Now, install and run the VNC client on your computer:

-On a Linux Computer, run the following command to install the xtightvncviewer package:

sudo apt-get install xtightvncviewer

-For other platforms, you can download TightVNC from tightvnc.com.


Automation and run at boot (Automatic startup)

You can create a simple file on Raspberry Pi and save some commands to run the VNC service. Save the commands so that you do not need to remember them again:


-Create a file containing the following shell script:

#!/bin/shvncserver :0 -geometry 1920x1080 -depth 24 -dpi 96


-Save the file, for example, VNC. Sh.

-Set an executable file:

chmod +x vnc.sh

-Then you can run the following command to execute this file at any time:

./vnc.sh

Set the machine to run automatically when it starts:

-Log on to the Raspberry Pi terminal as a root user:

sudo su

-Navigate to the/etc/init. d/directory:

cd /etc/init.d/

-Create a file containing the following script:

### BEGIN INIT INFO# Provides: vncboot# Required-Start: $remote_fs $syslog# Required-Stop: $remote_fs $syslog# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# Short-Description: Start VNC Server at boot time# Description: Start VNC Server at boot time.### END INIT INFO#! /bin/sh# /etc/init.d/vncbootUSER=rootHOME=/rootexport USER HOMEcase "$1" in start)  echo "Starting VNC Server"  #Insert your favoured settings for a VNC session  /usr/bin/vncserver :0 -geometry 1280x800 -depth 16 -pixelformat rgb565  ;; stop)  echo "Stopping VNC Server"  /usr/bin/vncserver -kill :0  ;; *)  echo "Usage: /etc/init.d/vncboot {start|stop}"  exit 1  ;;esacexit 0

-Save the file, for example, vncboot.

-Set this file to an executable file:

chmod 755 vncboot

-Enable dependency based on boot sequence:

update-rc.d /etc/init.d/vncboot defaults


-If the dependency based on the boot sequence is enabled successfully, you will see:

update-rc.d: using dependency based boot sequencing

-If it fails, you will see:

update-rc.d: error: unable to read /etc/init.d//etc/init.d/vncboot

-In this case, you can use the following command:

update-rc.d vncboot defaults

-Restart Raspberry Pi and you will find that the VNC service is running.


Now you can use a VNC client on your PC or laptop to connect to the VNC service and control Raspberry Pi. You can view the following guidelines based on your computer's operating system:

Linux

Mac OS

Windows



Address: http://www.raspberrypi.org/documentation/remote-access/vnc/README.md


Raspberry Pi and VNC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.