November 24, 2014

Remote Desktop using VNC




 When we are using different platform for developing projects, it might be a little annoying to change PC owing to different OS. Therefore, the remote software that developed by VNC could help us to solve this problem.  
  We use vnv viewer on our Window OS and connect to Ubuntu or Raspberry Pi at the same time.

For Raspberry Pi or other Linux platform that you want to connect:
  
Step 1. Install TightVNC Server
sudo apt-get install tightvncserver
Step 2. Start VNC Server
vncserver :1
# 1 means the number of the desktop you connect to. 
After entering the cmd, Pi would ask you to enter the password and confirm again. Then ask you whether to create a read-only password. Enter "n" to start. And now your VNC Server will open a new X desktop for you.
use "-geometry 1024x768" to determine the resolution on the client's desktop.
vncserver :1 -geometry 1024x768
Step 3. Start VNC Server automatically whenever start Pi
sudo nano /etc/init.d/tightvncserver
enter the example:
export USER='pi'
eval cd ~$USER
case "$1" in
  start)
    su $USER -c '/usr/bin/vncserver :1 -geometry 800x600'
    echo 'Starting vncserver for $USER'
    ;;
  stop)
    pkill Xtightvnc
    echo 'Vncserver Stopped'
    ;;
  *)
    echo "Usage: /etc/init.d/vncserver {start|stop}"
    exit 1
    ;;
esac
exit 0
the change the authority :
sudo chmod 755 /etc/init.d/tightvncserver
then
sudo update-rc.d tightvncserver defaults
For Ubuntu or Window OS client:
Step 1. install VNC Viewer
sudo apt-get install vncviewer
Step 2. connect
vncviewer hostIP:number
host means the ip address of the device you aim to connect. number means the number that you create for the device. 
Then it will ask for password. Enter the password and good luck!!

No comments :

Post a Comment