Raspbian “wheezy”(2012-12-16-wheezy-raspbian.zip)にvnc serverをインストールします
RPi VNC Server
http://elinux.org/RPi_VNC_Server
- install the Tight VNC Package
- パスワード設定
- VNC Viewerで接続
- VNC Server終了
- VNC Server起動(Option)
- VNC Serverの自動起動
- 実行権限を与える
- 起動時に実行設定
VNCパッケージをインストールします
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 |
pi@raspberrypi ~ $ sudo apt-get install tightvncserver Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: x11-xserver-utils xfonts-base xfonts-encodings xfonts-utils Suggested packages: tightvnc-java nickle cairo-5c xorg-docs-core The following NEW packages will be installed: tightvncserver x11-xserver-utils xfonts-base xfonts-encodings xfonts-utils 0 upgraded, 5 newly installed, 0 to remove and 4 not upgraded. Need to get 7,824 kB of archives. After this operation, 11.7 MB of additional disk space will be used. Do you want to continue [Y/n]? Y Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main tightvncserver armhf 1.3.9-6.4 [786 kB] Get:2 http://mirrordirector.raspbian.org/raspbian/ wheezy/main x11-xserver-utils armhf 7.7~3 [181 kB] Get:3 http://mirrordirector.raspbian.org/raspbian/ wheezy/main xfonts-encodings all 1:1.0.4-1 [584 kB] Get:4 http://mirrordirector.raspbian.org/raspbian/ wheezy/main xfonts-utils armhf 1:7.7~1 [92.2 kB] Get:5 http://mirrordirector.raspbian.org/raspbian/ wheezy/main xfonts-base all 1:1.0.3 [6,181 kB] Fetched 7,824 kB in 1min 25s (91.9 kB/s) Selecting previously unselected package tightvncserver. (Reading database ... 57830 files and directories currently installed.) Unpacking tightvncserver (from .../tightvncserver_1.3.9-6.4_armhf.deb) ... Selecting previously unselected package x11-xserver-utils. Unpacking x11-xserver-utils (from .../x11-xserver-utils_7.7~3_armhf.deb) ... Selecting previously unselected package xfonts-encodings. Unpacking xfonts-encodings (from .../xfonts-encodings_1%3a1.0.4-1_all.deb) ... Selecting previously unselected package xfonts-utils. Unpacking xfonts-utils (from .../xfonts-utils_1%3a7.7~1_armhf.deb) ... Selecting previously unselected package xfonts-base. Unpacking xfonts-base (from .../xfonts-base_1%3a1.0.3_all.deb) ... Processing triggers for man-db ... Processing triggers for menu ... Processing triggers for fontconfig ... Setting up tightvncserver (1.3.9-6.4) ... update-alternatives: using /usr/bin/tightvncserver to provide /usr/bin/vncserver (vncserver) in auto mode update-alternatives: using /usr/bin/Xtightvnc to provide /usr/bin/Xvnc (Xvnc) in auto mode update-alternatives: using /usr/bin/tightvncpasswd to provide /usr/bin/vncpasswd (vncpasswd) in auto mode Setting up x11-xserver-utils (7.7~3) ... Setting up xfonts-encodings (1:1.0.4-1) ... Setting up xfonts-utils (1:7.7~1) ... Setting up xfonts-base (1:1.0.3) ... Processing triggers for menu ... |
tightvncserverを起動してパスワードを設定します。このパスワードは表示だけ?って聞いてくるので’n’にしています
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
pi@raspberrypi ~ $ tightvncserver You will require a password to access your desktops. Password: Warning: password truncated to the length of 8. Verify: Would you like to enter a view-only password (y/n)? n xauth: file /home/pi/.Xauthority does not exist New 'X' desktop is raspberrypi:1 Creating default startup script /home/pi/.vnc/xstartup Starting applications specified in /home/pi/.vnc/xstartup Log file is /home/pi/.vnc/raspberrypi:1.log |
ログはこんな感じです
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
pi@raspberrypi ~ $ cat /home/pi/.vnc/raspberrypi:1.log 21/12/12 13:50:52 Xvnc version TightVNC-1.3.9 21/12/12 13:50:52 Copyright (C) 2000-2007 TightVNC Group 21/12/12 13:50:52 Copyright (C) 1999 AT&T Laboratories Cambridge 21/12/12 13:50:52 All Rights Reserved. 21/12/12 13:50:52 See http://www.tightvnc.com/ for information on TightVNC 21/12/12 13:50:52 Desktop name 'X' (raspberrypi:1) 21/12/12 13:50:52 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t 21/12/12 13:50:52 Listening for VNC connections on TCP port 5901 Font directory '/usr/share/fonts/X11/Type1/' not found - ignoring Font directory '/usr/share/fonts/X11/75dpi/' not found - ignoring Font directory '/usr/share/fonts/X11/100dpi/' not found - ignoring xrdb: No such file or directory xrdb: can't open file '/home/pi/.Xresources' |
fontが無いとかファイルが無いと出ていますが取り敢えずこの状態でもVNC接続はできます
この場合はTCP port 5901への接続となります
適当なVNC ViewerでRaspberry PiのVNC serverに接続してみます
VNC Serverを終了するにはディスプレイ番号を指定して終了します。上記の場合だと1になります
1 2 |
pi@raspberrypi ~ $ vncserver -kill :1 Killing Xtightvnc process ID 2192 |
VNC Serverを色数、解像度、ディスプレイ番号を指定して起動します
1 2 3 4 5 6 |
pi@raspberrypi ~ $ vncserver :0 -geometry 1280x720 -depth 24 New 'X' desktop is raspberrypi:0 Starting applications specified in /home/pi/.vnc/xstartup Log file is /home/pi/.vnc/raspberrypi:0.log |
ログはこんな感じです。今回の場合はディスプレイ番号0ですのでポート:5900になります
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
pi@raspberrypi ~ $ cat /home/pi/.vnc/raspberrypi:0.log 21/12/12 14:06:52 Xvnc version TightVNC-1.3.9 21/12/12 14:06:52 Copyright (C) 2000-2007 TightVNC Group 21/12/12 14:06:52 Copyright (C) 1999 AT&T Laboratories Cambridge 21/12/12 14:06:52 All Rights Reserved. 21/12/12 14:06:52 See http://www.tightvnc.com/ for information on TightVNC 21/12/12 14:06:52 Desktop name 'X' (raspberrypi:0) 21/12/12 14:06:52 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t 21/12/12 14:06:52 Listening for VNC connections on TCP port 5900 Font directory '/usr/share/fonts/X11/Type1/' not found - ignoring Font directory '/usr/share/fonts/X11/75dpi/' not found - ignoring Font directory '/usr/share/fonts/X11/100dpi/' not found - ignoring xrdb: No such file or directory xrdb: can't open file '/home/pi/.Xresources' |
Raspberry Piの電源ONで自動的にVNC Serverを起動するように設定します
http://elinux.org/RPi_VNC_Serverに記載されているスクリプトをcopy & pasteで作成します
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 |
pi@raspberrypi ~ $ sudo vi /etc/init.d/vncboot pi@raspberrypi ~ $ cat /etc/init.d/vncboot ### 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/vncboot USER=root HOME=/root export USER HOME case "$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 ;; esac exit 0 |
/etc/init.s/vncbootに実行権限を与えます
1 2 3 4 5 6 7 |
pi@raspberrypi ~ $ ls -l /etc/init.d/vncboot -rw-r--r-- 1 root root 692 Dec 21 14:19 /etc/init.d/vncboot pi@raspberrypi ~ $ sudo chmod 755 /etc/init.d/vncboot pi@raspberrypi ~ $ ls -l /etc/init.d/vncboot -rwxr-xr-x 1 root root 692 Dec 21 14:19 /etc/init.d/vncboot |
1 2 3 |
pi@raspberrypi ~ $ sudo update-rc.d /etc/init.d/vncboot defaults update-rc.d: using dependency based boot sequencing update-rc.d: error: unable to read /etc/init.d//etc/init.d/vncboot |
エラーが出たのでサイト情報に書かれている通りに再度実行
1 2 |
pi@raspberrypi ~ $ sudo update-rc.d vncboot defaults update-rc.d: using dependency based boot sequencing |
これで、Piの電源を入れると自動的にVNC Serverがディスプレイ番号:0(ポート5900)で起動するようになります。ただしこの場合はrootでVNC Serverを起動することになりますのでrootでvnc Serverのパスワードを設定しておく必要があります
ユーザ指定でVNC Serverを起動する場合は参考サイトの”Getting VNC Server to Work on a Specific User”を参考にして下さい