Me Geeky

Sharing Technology with You
Menu
  • Android
    • Gadgets
    • Android News
  • Apple
    • Activation Bypass
    • Cydia Tweaks And Apps
    • Quick Fixes
    • Download IPSW
  • Downloads
    • Custom Roms
    • Mods & Tweaks
    • Stock Roms
  • Reviews
    • Nokia
    • QMobile
    • Samsung
    • App Reviews
    • Apple Reviews
    • Others
  • Tips & Tricks
  • How to
  • Linux
Home
How to
How to Install VNC server on Ubuntu 14.04
How to

How to Install VNC server on Ubuntu 14.04

Muhammad Hashim

Installing VNC server on Ubuntu can become a little tricky sometimes. Recently I purchased a budget VPS for playing and making guides for Mgeeky.com server management section. Today I will show you how you can Install VNC server on you Ubuntu 14.04 VPS. For this process I am using Ubuntu 14.04 x64 Minimal.

What is VNC?

VNC stands for Virtual Network Computing, VNC is used to add Graphical User Interface is the Operating Systems that do not have it by default. VNC communication requires a VNC Server listening on a special Port, Desktop Environment and a VNC Viewer a.k.a Client.

How to Install VNC Server on Ubuntu 14.04?

This guide consists on several steps which include

  1. Accessing your Server via SSH
  2. Installing VNC Server and Desktop Environment
  3. Configuring VNC Server
  4. Creating a VNC service File
  5. Starting VNC server
  6. Accessing you VNC Server using VNC Viewer

Step 1: Accessing your Server via SSH

This step is pretty simple and most of you may be already familiar with this, but for those who are not, You have to access your Server using SSH Client, Such as Putty for Windows. Just insert the IP address of your server and click “Connect”. You will be asked for username, type “root”, without quotes and press Enter. Next, You need to enter the root password which you received from your server company, via E-Mail.

Once you are logged in, Proceed to next Step.

Step 2: Installing VNC Server and Desktop Environment

In this step we’ll execute a couple of commands which you have to copy and paste ( Right Click if you are using putty ) and you’ll be good to go.

First of all we’ll update the packages of Ubuntu using the following command.

apt-get update

Next we’ll install Desktop Environment packages and VNC server packages.

apt-get install xfce4 xfce4-goodies tightvncserver

Now We’ve to start VNC server and set a secure Password for VNC viewer. Run the following command and you would be asked for a password.

vncserver

Now add a secure password that you’ll need while accessing VNC.

Step 3 : Configuring VNC Server

In step 2, We started VNC server by typing vncserver command only for setting the Password. Now we have to stop the VNC server to configure it. Without stopping vncserver, configuring it is impossible. So, Just paste the following command to stop vncserver.

vncserver -kill :1

After stopping vncserver, We’ll backup xstartup file. xstartup file tells the VNC Server that what it needs to start when the vncserver starts. Paste the following command in SSH client.

mv ~/.vnc/xstartup ~/.vnc/xstartup.bak

After backing up the xstartup file, You just have to make another xtartup file and add some lines of code in this file. For this purpose I am uning nano editor, If you don’t have nano you can get it by executing

apt-get install nano

Now edit xtartup file using nano:

nano ~/.vnc/xstartup

Insert the following commands in the xstartup file and save it using ctrl+o.

#!/bin/sh

xrdb $HOME/.Xresources
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession

Next we have to make the xstartup file file executable,

chmod +x ~/.vnc/xstartup

 Step 4: Creating a VNC service File

Creating VNC service file is recommended. This step add vncserver as a service in Ubuntu. You can start, Stop or Restart anytime, If you create a VNC service file. To do this you have to make a file named vncserver in /etc/init.d/

nano /etc/init.d/vncserver

This will open a text editor and you’ll be able to add commands in it. just copy and paste the following code in it and you’ll be good to go.

#!/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

Now we have to make this file executable by executing this command in SSH client.

chmod +x /etc/init.d/vncserver

Now you can start vncserver as a service by running the following command

service vncserver start

 Step 5 : Starting VNC server

This step is a little tricky as you have to replace some words with actual values. This step will start the VNC Server and you would be able to access it using any VNC Viewer.

ssh -L 5901:127.0.0.1:5901 -N -f -l  USER SERVER_IP

Don’t forget to replace USER with actual user that you want the VNC server to work as, and SERVER_IP with the actual IP Address of your server.

Step 6 : Accessing VNC Server using VNC Viewer

This step is very simple. Just install any VNC Viewer, I am using UltraVNC, Start the VNC Viewer and enter your server’s IP Address followed by the port number which is :1  and hit connect. It will ask you for the password that you entered in Step 2.

If you like our guides, do share this with your friends and others. Join us on Social Media and also Don’t forget to provide your feedback. Cheers 🙂

Share
Tweet
Google+
Pinterest
Stumble
Prev Article
Next Article

Related Articles

How to Install Webuzo on CentOS 6
Webuzo is a web-based single user control panel for VPS …

How to Install Webuzo on CentOS 6

Huawei is becoming popular day by day and specially from …

How To Root Huawei Honor 3c Lite or Holly

About The Author

Muhammad Hashim

Leave a Reply

Cancel reply

Pages

  • About us
  • Contact us
  • Download IPSW
  • FB Policy
  • Sitemap

Me Geeky

Sharing Technology with You
Copyright © 2023 Me Geeky
Theme by MyThemeShop.com
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.Accept Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled

Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.

Non-necessary

Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.

SAVE & ACCEPT