Close

Remote Desktop on Raspberry pi (vnc)

Ok, now we are going to enable remote session on raspberry pi through windows. Does not matter what windows you have. You will be able to control rasp, from your windows mouse and keyboard and watch  it on youw windows display.

With this way i will explain, you have not to connect mouse ,keyboard and display on your raspberry to make the configurations instead of just power to operate.But maybe only first you have to connect it. Let ‘s start

1. Even if with new Rasbian version ssh is enable by default, you may need to enable it, in case it is not enable.In this case unfortunately you have to connect mouse .keyboard display just to enable it.Connect your rasp with internet through wifi or Ethernet cable.

Next video show how to enable it

2.Download putty. It is a free  Telnet and SSH client so that connect remotely with rasp. Open it and place the internal ip address.If you don’t know it you have to go to terminal on your rasp. and type “ifconfig”. It is something start with 192.168.x.x.

3.Now you will install TightVNC. through putty ,you have to  send ”

sudo apt-get install tightvncserver

4.Run

tightvncserver

and place a password ,i think with 8 characters.

5.Enable vnc server in rasp sending

vncserver :1 -geometry 1920x1080 -depth 24

:0 is the desktop screen

6.Install now TightVNC on your windows. You need to install only client not server, does not matter if you server too.We will discuss later about vnc on your windows.

7.Now go to /home/pi and make a file ,name it “vnc.sh”. Open it and paste

#!/bin/sh
vncserver :1 -geometry 1920x1080 -depth 24 -dpi 96

Make the file executable typing

chmod +x vnc.sh

Then every time you run.Copy vnc.sh to /home/pi/.vnc

./vnc.sh

it will return you at witch desktop is running vnc (look at the first photo at step10), we will need it later ,when configuring tightvnc.

(You must first run ./vnc.sh to enable server run , and after that open tightvnx on windows computer and ente ip and desktop number)

8. If you want server, run every time you start your raspberry and don’t run ./vnc.sh every time do the following. Get into pi as superuser typing

sudo su

got to this dierectory

cd /etc/init.d/

Create a new file typing with name “vncboot” typing

touch vncboot

Open it to edit typing (nano here is just an editor)

nano vncboot

copy paste this text

### 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 :1 -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

and then press ctrl+x to close , press “Y” to save and hit enter,

make it executable typing

chmod 755 vncboot

9.Now place it at boot sequence typing

update-rc.d vncboot defaults

if it is ok you will see

update-rc.d: using dependency based boot sequencing

if you don’t see this type it with the path, like this

update-rc.d /etc/init.d/vncboot defaults

Reboot to enable changes and finish.

10. Now open tightvnc viewer on windows. At remote host you will write you internal ip (network ip) folowin by :1, or :0, :2… Those are desktop views.. It should be :0 as we adjust it, if you mesh it up and you don’t know what is the desktop view ,you type

./vnc.sh

Look the next photo and take care at line

New ‘X’ desktop is raspberry:1. It says desktop is 1 .

vncsh

So, move on tightvnx and your ip follow by desktop number as photo here, press connect and

tightvnc

Tightvnc will ask you for the password you enter at step 4

Untitled

If you have any problem i may  help you

 

 

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2024 Electronics | WordPress Theme: Annina Free by CrestaProject.
%d bloggers like this: