树莓派之远程桌面

1.VNC远程访问

1.1 ssh登陆树莓派

 

1.2 安装vnc服务端

执行以下命令

sudo apt-get install tightvncserver

 

安装完成后先设定vnc密码

vncpasswd

 

设置开机启动,在/etc/init.d/中创建一个文件,例如tightvncserver

sudo vim /etc/init.d/tightvncserver

内容如下


### BEGIN INIT INFO
# Provides: tightvnc
# 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 as a service
# Description: Start VNC Server as a service.
### END INIT INFO
#!/bin/sh
# /etc/init.d/tightvncserver
# Customised by raspicndotcom
#http://www.penguintutor.com/linux/tightvnc
# Set the VNCUSER variable to the name of the user to start tightvncserver under
VNCUSER='pi'
eval cd ~$VNCUSER
case "$1" in
start)
   su $VNCUSER -c '/usr/bin/tightvncserver :1  -geometry 1024x640 -depth 16 -pixelformat rgb565'
   echo "Starting TightVNC server for $VNCUSER "
   ;;
stop)
   pkill Xtightvnc
   echo "Tightvncserver stopped"
   ;;
*)
   echo "Usage: /etc/init.d/tightvncserver {start|stop}"
   exit 1
   ;;
esac
exit 0
#


 

然后给tightvncserver文件添加执行权限,并添加到开机启动列表中

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

 

 

1.3 pc端连接VNC

下载windows客户端RealVNC Viewer

登陆地址输入 “IP地址:控制台号码”.

输入vnc密码之后即可看到xwindows的图形界面


你可能感兴趣的:(Raspberry,Pi)