Bboysoul's Blog

首页 归档 资源 公告

ubuntu-VNC连接树莓派

January 27, 2017

 其实ubuntu vnc连接树莓派很简单,首先给树莓派安装vnc服务,然后打开vnc服务,最后ubuntu用远程桌客户端测试连接就好了  不过要注意连接前一定要打开vnc服务,树莓派连接要有控制台号码,如192.168.1.102:1后面的1不是端口号而是控制台号码

步骤

一.给树莓派安装vnc服务首先用ssh连接上树莓派,树莓派的默认用户名密码是pi和raspberry然后 sudo apt-get update sudo apt-get upgrade sudo apt-get install tightvncserver 二.设置vnc密码vncpasswd 输入密码两次后提示你输入viewonly密码,这个设置不设置随便你 三.给树莓派打开vncserver输入 vncserver 四.打开ubuntu的远程桌面连接客户端(内置的)输入(ip地址:控制台号码) 最后你可以设置vnc服务开机启动, 在/etc/init.d/中创建一个文件tightvncserver 然后输入 vim /etc/init.d/tightvncserver 之后在文件里输入

#!/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 -depth 16 -geometry 800x600 :1'
echo "Starting TightVNC server for $USER "
;;
stop)
# 终止命令行。此处控制台号码与启动一致。
su $USER -c '/usr/bin/tightvncserver -kill :1'
echo "Tightvncserver stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0

然后修改一下文件的权限 sudo chmod 755 tightvncserver 之后重启验证一下vncservser是不是开机自启 sudo shutdown -r now


Tags:
本文总阅读量 本文总访客量 本站总访问量 本站总访客数