November 08, 2026, 07:59:59 pm

Author Topic: How to - Install VNC on Ubuntu 14.04  (Read 19 times)

0 Members and 1 Guest are viewing this topic.

Offline Red Wolf

How to - Install VNC on Ubuntu 14.04
« on: July 10, 2015, 11:15:22 pm »
Hi  :D
In this tutorial you will learn how to install VNC on a remote server, linux, ubuntu 14.04 (works with older versions).
We gona install and configure VNC and desktop.

What you need:
A Linux VPS
Nano - editing files, mostly VPS servers have it installed.
Ubuntu
SSH - to connect to server
VNC Client - to connect to desktop/vncserver

Lets start:

1:
     Start with
     
Code: [Select]
sudo apt-get update     Now install vncserver, I prefer tightvncserver for ubuntu, but wont say same for centos.
     
Code: [Select]
sudo apt-get install xfce4 xfce4-goodies tightvncserver     Now test it,
     
Code: [Select]
vncserver :1It should look sth like this, but with a mouse icon
Spoiler (hover to show)
     if its working, kill it
     
Code: [Select]
vncserver -kill :1

2:
     Lets configure our VNC server
     
     but lets make a backup of xstartup just incase
     
Code: [Select]
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak     Open a new file with nano
     
Code: [Select]
nano ~/.vnc/xstartup     insert
     
Code: [Select]
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
     Now save and exit by pressing CTRL + X
     Grand permissions
     
Code: [Select]
sudo chmod +x ~/.vnc/xstartup     


3:
Create service file

     
Code: [Select]
sudo nano /etc/init.d/vncserver     insert
   
Code: [Select]
#!/bin/bash
PATH="$PATH:/usr/bin/"
export USER="user"
DISPLAY="1"
DEPTH="16"
GEOMETRY="1024x768"
OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY} -localhost"
. /lib/lsb/init-functions

case "$1" in
start)
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;

stop)
log_action_begin_msg "Stopping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;

restart)
$0 stop
$0 start
;;
esac
exit 0

     CTRL + X
     grant permissions
     
Code: [Select]
sudo chmod +x /etc/init.d/vncserver


Congratulations!
Start vncserver:
Code: [Select]
sudo service vncserver startor you can use
Code: [Select]
vncserver :1or even
Code: [Select]
vncserverFor security reasons, sometimes you will have problems installing things in VNC as a ROOT user.

I guess ill post more tuts for ubuntu on the future.
For any problems PM me.

I got some help from DIGITALOCEAN
« Last Edit: July 10, 2015, 11:30:26 pm by Red Wolf »
Life can only be understood backwards but it must be lived forwards. -Soren Kierkegaard