Raspberry Pi: Installing TightVNC

转载 2015年05月20日 07:46:54

Installing TightVNC on the Raspberry Pi

Sometimes connecting a keyboard, mouse, and monitor to Raspberry Pi is really inconvenient. But what’s the alternative if you want to interact directly with your Raspberry Pi’s GUI? PuTTY is an excellent SSH client, but the command shell is no substitute. WinSCP is an excellent SFTP client, but again, no substitute for a fully-functional GUI. The answer to this predicament? TightVNC, by GlavSoft LLC.


Background

According to TightVNC Software’s website, ‘TightVNC is a free remote control software package. With TightVNC, you can see the desktop of a remote machine and control it with your local mouse and keyboard, just like you would do it sitting in the front of that computer.‘

What is VNC? According to Wikipedia, ‘Virtual Network Computing (VNC) is a graphical desktop sharing system that uses the RFB protocol (remote framebuffer) to remotely control another computer. It transmits the keyboard and mouse events from one computer to another, relaying the graphical screen updates back in the other direction, over a network.‘

If you are a Windows user, you are no doubt familiar with Microsoft’s Remote Desktop Connection (RDC). GlavSoft’s TightVNC and Microsoft’s RDC are almost identical in terms of functionality.


Installation

TightVNC has two parts, the client and the server. The TightVNC Server software is installed on the Raspberry Pi (RaspPi). The RaspPi acts as the TightVNC Server. The client software, the TightVNC Java Viewer, is installed on a client laptop or desktop computer.

I used PuTTY from my Windows 8 laptop to perform the following installation and configuration. I successfully performed this process on a RaspPi Model B, with copies of both Raspbian “wheezy” and Soft-float Debian “wheezy”.


TightVNC Server

To install the TightVNC Server software, run the following commands from the RaspPi. The first command is are optional, but usually recommended before installing new software.

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install tightvncserver

To test the success of the TightVNC Server installation, enter vncserver in the command shell. The first time you run this command, you will be asked to set a VNC password for the current user (‘pi’). The password can be different than the system password used by this user. After inputting a password, you should see output similar to the below screen grab. This indicates that TightVNC is running.

First Time vcnserver Command 1

By default, TightVNC runs on a port 5901. To verify TightVNC is running on 5901, enter the command sudo netstat -tulpn. You should see output similar to the screen grab below. Note the entry for TightVNC on port 5901. Stop TightVNC by entering the vncserver -kill :1 command.

First Time vcnserver Command 2

You may have noticed TightVNC was also running on port 6001. This is actually used by the X Window System, aka ‘X11′. A discussion of X11 is out of scope for this post, but more info can be found here.


Automatic Startup

For TightVNC Server to start automatically when we boot up our RaspPi, we need to create an init script and add it to the default runlevels. I had a lot of problems with this part until I found this post, with detailed instructions on how to perform these steps.

Start by entering the following command to create the init script:

sudo nano /etc/init.d/tightvncserver

Copy and paste the init script from the above post, into this file. Change the user from ‘pi’ to your user if it is different than ‘pi’. Save and close the file.

#!/bin/sh
### BEGIN INIT INFO
# Provides:          tightvncserver
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO

# More details see: 
# http://www.penguintutor.com/linux/tightvnc

### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER='pi'
### End customization required

eval cd ~$USER

case "$1" in
  start)
    su $USER -c '/usr/bin/tightvncserver :1'
    echo "Starting TightVNC server for $USER "
    ;;
  stop)
    pkill Xtightvnc
    echo "Tightvncserver stopped"
    ;;
  *)
    echo "Usage: /etc/init.d/tightvncserver {start|stop}"
    exit 1
    ;;
esac
exit 0

Next, execute these two commands to add the script to the default runlevels:

sudo chmod 755 /etc/init.d/tightvncserver
sudo update-rc.d tightvncserver defaults

To complete the TightVNC Server installation, restart the RaspPi.


TightVNC Java Viewer

According to the website, TightVNC Java Viewer is a fully functional remote control client written entirely in Java. It can work on any computer where Java is installed. It requires Java SE version 1.6 or any later version. That can be Windows or Mac OS, Linux or Solaris — it does not make any difference. And it can work in your browser as well. On the client computer, download and unzip the TightVNC Java Viewer. At the time of this post, the current TightVNC Java Viewer version was 2.6.2.

Once the installation is complete, double-click on the ‘tightvnc-jviewer.jar’ file. Running the Java jar file will bring up the ‘New TightVNC Connection’ window, as seen in the example below. Input the RaspPi’s IP address or hostname, and the default TightVNC port of 5901. The use of SSH tunneling is optional with the TightVNC Viewer. If you are concerned about security, use SSH.

TightVNC Connection Window

Clicking the ‘Connect’ button, you are presented with a window to input the user’s VNC password.

TightVNC VNC Authentication Window

Optionally, if using SSH, the user’s SSH password is required. Again, the same user can have different SSH and VNC passwords, as mine does.

TightVNC SSH Authentication Window

If everything was installed and configured correctly, you should be presented with a TightVNC window displaying the RaspPi’s desktop. Note the TightVNC toolbar along the top edge of the window. The ‘Ctrl’ and ‘Alt’ buttons are especially useful to send either of these two key inputs to the RaspPi on a Windows client. Using the ‘Set Options’ button, you can change the quality of TightVNC’s remote display. Note these changes this can affect performance.

Raspberry Pi's X Desktop

Congratulations, no more connecting a keyboard, mouse, and monitor to you RaspPi to access the GUI. I suggest reading the documentation on the TightVNC website, as well as the ‘README.txt’ file, included with the TightVNC Java Viewer. There is a lot more to TightVNC than I have covered in this brief introductory post, especially in the README.txt file. -gs


Reference

From: https://programmaticponderings.wordpress.com/2012/12/26/installing-tightvnc-on-the-raspberry-pi/

ubuntu 通过VNC 显示Raspberry PI界面

1、将raspberry连接上路由器,通过以下命令查找路由器网段连接的设备 wiwa@tech:~$ sudo nmap -sP 192.168.31.0-254 Starting Nmap 7....
  • eibo51
  • eibo51
  • 2016年11月22日 21:11
  • 718

Installing ROS Kinetic on the Raspberry Pi

http://wiki.ros.org/ROSberryPi/Installing%20ROS%20Kinetic%20on%20the%20Raspberry%20Pi Installin...
  • AMDS123
  • AMDS123
  • 2017年05月01日 00:28
  • 5854

OPENWRT ON ARM-BASED PLATFORM (RASPBERRY PI 2)

http://dab-embedded.com/en/blogs/openwrt-on-arm-based-platform-raspberry-pi-2/ http://blog.csdn.n...
  • gaoguoxin2
  • gaoguoxin2
  • 2016年03月17日 22:11
  • 460

《Raspberry Pi Cookbook》pdf

内容简介 The world of Raspberry Pi is evolving quickly, with many new interface boards and software l...
  • cf406061841
  • cf406061841
  • 2017年09月16日 10:49
  • 405

树莓派(Raspberry Pi)瞎捣鼓

本周入手了新玩具Raspberry Pi 3 model B,利用周末稍微玩了一下,感觉体验还行,可以用来当个小私服来用或者用来当电视盒子娱乐用。 点赞点:支持无线网络和蓝牙哦 吐槽点:貌似没有电...
  • dushenzhi
  • dushenzhi
  • 2016年04月17日 00:07
  • 1747

Raspberry Pi 3学习系列——基本使用

概述树莓派其实就是一个微型的计算机,我们可以在上面实现很多PC机的功能装各种操作系统、搭建服务器。但是不同的是在树莓派上有很多GPIO引脚,我们可以通过树莓派来控制这些引脚传输物理信号,比如让led灯...
  • Kelsey98
  • Kelsey98
  • 2018年01月02日 11:06
  • 160

Raspberry Pi 远程登录配置

1. 设置支持SSH远程登录: 使能SSH登录选项: 查看树莓派的IP地址,这里使用Wifif连接的方式,因此, IP是192.168.31.50: 2. 在电脑使用SSH登录工具登...
  • Linjingke32
  • Linjingke32
  • 2017年04月15日 13:40
  • 751

raspberry pi 的 C 程序编写

linux 都带了 gcc, 简单程序可以在树莓派中,直接编译 复杂的程序,可以用 bcm (因为芯片是 broadcom 的) 的 toolchain 来编译 http://hertavil...
  • span76
  • span76
  • 2015年04月30日 10:47
  • 1540

Raspberry pi3 入门一

网络WiFi扫描网络iwlist wlan0 scan在如下文件/etc/wpa_supplicant/wpa_supplicant.conf 添加WIFI的ID和密码。ctrl_interface=...
  • EAIBOT
  • EAIBOT
  • 2016年04月30日 15:40
  • 2999

Raspberry Pi: VNC安装与配置

Server1.下载安装TightVNC Server$ sudo apt-get install tightvncserver 2.开启vncserver$ vncserver 此时会要求设置密码,...
  • IOIO_
  • IOIO_
  • 2017年06月19日 22:44
  • 424
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Raspberry Pi: Installing TightVNC
举报原因:
原因补充:

(最多只允许输入30个字)