Raspberry Pi – VNC – X11VNC server
Dit voorbeeld laat zien hoe je een VNC server op een Raspberry Pi installeert, zodat je “headless” een grafische verbinding kan leggen via een andere computer.
Het voordeel van de X11VNC is dat je ook kan inloggen als er al een display aangesloten is op de Raspberry Pi.
Je kan dan bijvoorbeeld met een Windows computer waar een TightVNC client op draait, de Raspberry Pi overnemen.
Installatie
1) Download X11VNC met het volgende commando: wget http://goo.gl/MbfUEp -O isx11.sh
2) Installeer X11VNC met het volgende commando: sudo bash isx11.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
#!/bin/bash # A very crude script to setup X11VNC inspired by MrEngmans Realtek RTL8188CUS script and based upon my autosimplesamba # V0.2a 16Feb14 - removed commented lines :) if [ -z $1 ] then HDIR="/home/pi" USERID="pi" GROUPID="pi" else HDIR=/home/$1 USERID=`id -n -u $1` GROUPID=`id -n -g $1` fi echo echo "This script will install X11VNC server (to let you remotely control your Pi) in a very simple manner" echo " " echo "It only requires the password you wish to use" echo "I recommend using raspberry as the password unless your working in a dangerous hackers paradise" echo " " read -p "Press any key to continue..." -n1 -s echo echo while true; do echo read -p "Please enter the password you wish to use for remote access - " X11PASS echo echo "You have set your remote access password to \"$X11PASS\", is that correct?" echo read -p "press Y to continue, any other key to re-enter the name. " -n1 RESPONSE if [ "$RESPONSE" == "Y" ] || [ "$RESPONSE" == "y" ]; then echo break fi echo done apt-get update apt-get install -q -y x11vnc #smbpasswd -a pi mkdir -p $HDIR/.vnc chown -R $USERID:$GROUPID $HDIR/.vnc x11vnc -storepasswd $X11PASS $HDIR/.vnc/passwd chown -R $USERID:$GROUPID $HDIR/.vnc mkdir -p $HDIR/.config chown -R $USERID:$GROUPID $HDIR/.config cd $HDIR/.config mkdir -p autostart chown -R $USERID:$GROUPID $HDIR/.config/autostart cd autostart rm -f x11vnc.desktop #touch -f x11vnc.desktop echo "[Desktop Entry]" > x11vnc.desktop echo "Encoding=UTF-8" >> x11vnc.desktop echo "Type=Application" >> x11vnc.desktop echo "Name=X11VNC" >> x11vnc.desktop echo "Comment=" >> x11vnc.desktop echo "Exec=x11vnc -forever -usepw -display :0 -ultrafilexfer" >> x11vnc.desktop echo "StartupNotify=false" >> x11vnc.desktop echo "Terminal=false" >> x11vnc.desktop echo "Hidden=false" >> x11vnc.desktop chown -R $USERID:$GROUPID $HDIR/.config/autostart # time to finish! echo echo echo "X11VNC installed" echo echo |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
pi@raspberrypi:~ $ wget http://goo.gl/MbfUEp -O isx11.sh --2016-03-04 18:56:57-- http://goo.gl/MbfUEp Resolving goo.gl (goo.gl)... 85.113.230.223, 85.113.230.230, 85.113.230.229, ... Connecting to goo.gl (goo.gl)|85.113.230.223|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: https://dl.dropbox.com/s/xuhcps3c7s0anoj/simplex11vnc.sh [following] --2016-03-04 18:56:57-- https://dl.dropbox.com/s/xuhcps3c7s0anoj/simplex11vnc.s h Resolving dl.dropbox.com (dl.dropbox.com)... 45.58.74.38, 45.58.74.6 Connecting to dl.dropbox.com (dl.dropbox.com)|45.58.74.38|:443... connected. HTTP request sent, awaiting response... 302 FOUND Location: https://dl.dropboxusercontent.com/s/xuhcps3c7s0anoj/simplex11vnc.sh [f ollowing] --2016-03-04 18:56:57-- https://dl.dropboxusercontent.com/s/xuhcps3c7s0anoj/sim plex11vnc.sh Resolving dl.dropboxusercontent.com (dl.dropboxusercontent.com)... 108.160.173.5 Connecting to dl.dropboxusercontent.com (dl.dropboxusercontent.com)|108.160.173. 5|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 1963 (1.9K) [text/x-sh] Saving to: ‘isx11.sh’ isx11.sh 100%[=====================>] 1.92K --.-KB/s in 0s 2016-03-04 18:56:58 (10.2 MB/s) - ‘isx11.sh’ saved [1963/1963] pi@raspberrypi:~ $ sudo bash isx11.sh This script will install X11VNC server (to let you remotely control your Pi) in a very simple manner It only requires the password you wish to use I recommend using raspberry as the password unless your working in a dangerous h ackers paradise Press any key to continue... Please enter the password you wish to use for remote access - raspberry You have set your remote access password to "raspberry", is that correct? press Y to continue, any other key to re-enter the name. y Get:1 http://archive.raspberrypi.org jessie InRelease [13.2 kB] Get:2 http://mirrordirector.raspbian.org jessie InRelease [15.0 kB] Get:3 http://archive.raspberrypi.org jessie/main armhf Packages [142 kB] Hit http://archive.raspberrypi.org jessie/ui armhf Packages Get:4 http://mirrordirector.raspbian.org jessie/main armhf Packages [8,963 kB] Hit http://archive.raspberrypi.org jessie/staging armhf Packages Ign http://archive.raspberrypi.org jessie/main Translation-en_GB Ign http://archive.raspberrypi.org jessie/main Translation-en Ign http://archive.raspberrypi.org jessie/staging Translation-en_GB Ign http://archive.raspberrypi.org jessie/staging Translation-en Ign http://archive.raspberrypi.org jessie/ui Translation-en_GB Ign http://archive.raspberrypi.org jessie/ui Translation-en Get:5 http://mirrordirector.raspbian.org jessie/contrib armhf Packages [37.5 kB] Get:6 http://mirrordirector.raspbian.org jessie/non-free armhf Packages [70.3 kB] Get:7 http://mirrordirector.raspbian.org jessie/rpi armhf Packages [1,356 B] Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_GB Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en Ign http://mirrordirector.raspbian.org jessie/main Translation-en_GB Ign http://mirrordirector.raspbian.org jessie/main Translation-en Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_GB Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_GB Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en Fetched 9,243 kB in 16s (550 kB/s) Reading package lists... Done Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: libvncclient0 libvncserver0 tcl tcl8.6 tk tk8.6 x11vnc-data Suggested packages: tcl-tclreadline The following NEW packages will be installed: libvncclient0 libvncserver0 tcl tcl8.6 tk tk8.6 x11vnc x11vnc-data 0 upgraded, 8 newly installed, 0 to remove and 12 not upgraded. Need to get 1,621 kB of archives. After this operation, 3,403 kB of additional disk space will be used. Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libvncclient0 armhf 0.9.9+dfsg2-6.1+deb8u1 [118 kB] Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main libvncserver0 armhf 0.9.9+dfsg2-6.1+deb8u1 [174 kB] Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main tcl8.6 armhf 8.6.2+dfsg-2 [122 kB] Get:4 http://mirrordirector.raspbian.org/raspbian/ jessie/main tcl armhf 8.6.0+8+b1 [5,508 B] Get:5 http://mirrordirector.raspbian.org/raspbian/ jessie/main tk8.6 armhf 8.6.2-1 [71.0 kB] Get:6 http://mirrordirector.raspbian.org/raspbian/ jessie/main tk armhf 8.6.0+8+b1 [5,534 B] Get:7 http://mirrordirector.raspbian.org/raspbian/ jessie/main x11vnc-data all 0.9.13-1.2 [215 kB] Get:8 http://mirrordirector.raspbian.org/raspbian/ jessie/main x11vnc armhf 0.9.13-1.2 [910 kB] Fetched 1,621 kB in 1s (1,286 kB/s) Selecting previously unselected package libvncclient0:armhf. (Reading database ... 126040 files and directories currently installed.) Preparing to unpack .../libvncclient0_0.9.9+dfsg2-6.1+deb8u1_armhf.deb ... Unpacking libvncclient0:armhf (0.9.9+dfsg2-6.1+deb8u1) ... Selecting previously unselected package libvncserver0:armhf. Preparing to unpack .../libvncserver0_0.9.9+dfsg2-6.1+deb8u1_armhf.deb ... Unpacking libvncserver0:armhf (0.9.9+dfsg2-6.1+deb8u1) ... Selecting previously unselected package tcl8.6. Preparing to unpack .../tcl8.6_8.6.2+dfsg-2_armhf.deb ... Unpacking tcl8.6 (8.6.2+dfsg-2) ... Selecting previously unselected package tcl. Preparing to unpack .../tcl_8.6.0+8+b1_armhf.deb ... Unpacking tcl (8.6.0+8+b1) ... Selecting previously unselected package tk8.6. Preparing to unpack .../tk8.6_8.6.2-1_armhf.deb ... Unpacking tk8.6 (8.6.2-1) ... Selecting previously unselected package tk. Preparing to unpack .../tk_8.6.0+8+b1_armhf.deb ... Unpacking tk (8.6.0+8+b1) ... Selecting previously unselected package x11vnc-data. Preparing to unpack .../x11vnc-data_0.9.13-1.2_all.deb ... Unpacking x11vnc-data (0.9.13-1.2) ... Selecting previously unselected package x11vnc. Preparing to unpack .../x11vnc_0.9.13-1.2_armhf.deb ... Unpacking x11vnc (0.9.13-1.2) ... Processing triggers for man-db (2.7.0.2-5) ... Processing triggers for gnome-menus (3.13.3-6) ... Processing triggers for desktop-file-utils (0.22-1) ... Processing triggers for mime-support (3.58) ... Setting up libvncclient0:armhf (0.9.9+dfsg2-6.1+deb8u1) ... Setting up libvncserver0:armhf (0.9.9+dfsg2-6.1+deb8u1) ... Setting up tcl8.6 (8.6.2+dfsg-2) ... Setting up tcl (8.6.0+8+b1) ... Setting up tk8.6 (8.6.2-1) ... Setting up tk (8.6.0+8+b1) ... Setting up x11vnc-data (0.9.13-1.2) ... Setting up x11vnc (0.9.13-1.2) ... Processing triggers for libc-bin (2.19-18+deb8u3) ... stored passwd in file: /home/pi/.vnc/passwd X11VNC installed |
3) Tijdens de installatie word gevraagd om het wachtwoord in te stellen.
4) Reboot de pi met het commando: sudo reboot
Je kan nu connectie maken met de VNC server doormiddel van een client op een andere computer:
Bron: cymplecy.wordpress.com