Here is Updated Guide For Using Rackspace & HP Cloud Server VNC Remote Desktop on Ubuntu 14.04 LTS With Step by Step Commands With TightVNC. Older guide is here – Ubuntu with GUI on Rackspace Cloud Server as VNC Remote Desktop. We were thinking to publish new versions of guides, in fact published some of them, but specially for this article – it is on request of a reader over Twitter. Those who are not aware about Virtual Network Computing (VNC) can read the theory here.
In very short, there are not huge differences between a server operating system and a desktop operating system. If you can not handle SSH and that is a reason of using VNC, then we will suggest you to use a command line file manager for SSH instead of using VNC.
After running some command, you can use the virtual server with full GUI from your local computer. Do not do these steps for active server running serious website(s).
---
For security reasons after Snowden revelations and for the sake of forcing non-Free software not to get auto-installed, the process has been difficult than before. As the kernel has been patched, it actually does not matter on which version – all will give a slight pain.
This guide brings the classic Ubuntu’s desktop unity. Other guides on Digital Ocean or somewhere else are not for Ubuntu Desktop’s one. Their hardware may not carry the load or they may fear for networking security.
Rackspace & HP Cloud Server VNC Remote Desktop (Ubuntu 14.04) : Introduction
This type, we have mixed two Cloud IaaS providers as specific type of provider for a particular guide. HP Cloud is almost the same like Rackspace, it is also OpenStack driven on the software side, but hardware, cost and security are better on HP Cloud. But the word GUI can be a joke for current control panel of HP Cloud, if you try to compare with Rackspace. You need to configure router for HP Cloud if this is the first thing which you are going to do on HP Cloud – port 5901 should be allowed on connect from router.
The localhost, that means your computer can a MicroSoft Windows computer, a Mac or a GNU/Linux PC. For MicroSoft Windows computer, exactly like the previous guide – you’ll be using PuTTY. For Mac or GNU/Linux; you are using Terminal/iTerm2 and Terminal, respectively.
First, spin up an instance with 1GB of RAM. Select Ubuntu 14.04 LTS as server operating system. HP Cloud will charge around 30 USD per month on 720 hours / month basis. After the instance is ready, you need to SSH to the server either via PuTTY or Terminal/iTerm2. We are writing the steps after login as root to the remote server. 1 GB RAM is for example, we could be using any amount of RAM. As the virtual instances are not exactly for running graphical stuffs, quality of display actually sucks. The VNC server software we will be using is TightVNC. There are other softwares like TightVNC. For HP Cloud, associate a floating IP to the instance.
On your localhost, you need to download a software from TightVNC’s official website – install Realvnc-client or TightVNC.
For GNU/Linux use vino, for Mac, you need nothing – OS X has that needed package installed.
If you can rightly follow the guide as test and connect as VNC remote desktop, before deleting, take full server snapshot both for HP Cloud and Rackspace before deleting. Next time, you’ll be simply spinning up from the snapshot.
This guide works for Cloud edition.
For HP Cloud, you need another extra step – activate password passed login and deactivate key based login.
Never forget – you can test from one GNU/Linux on that about testing VNC! GNU/Linux & UNIX are multiple users’ operating system. You can test from Android device with VNC client. For security reasons, now configuration has been tad hard.
Rackspace & HP Cloud Server VNC Remote Desktop (Ubuntu 14.04) : Commands
The previous guide is good for some screenshots for the Rackspace users. Run :
1 | apt update -y && apt upgrade -y |
If you face a colorful window on SSH for the upgrade, only hit the return / enter key from keyboard.
We will use the classic Ubuntu desktop package for this guide. Run this command :
1 | dpkg -l | grep vnc |
If nothing returns, that is what is expected. There should not be any other vnc
running. We will run one command to install all the needed packages on Rackspace & HP Cloud Server VNC remote desktop setup on Ubuntu 14.04 :
1 | sudo apt-get --install-recommends install ubuntu-desktop |
--install-recommends
flag makes the package compatible with patches, this was not needed before :
1 | sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal |
now install VNC server software :
1 | sudo apt-get install vnc4server |
OK, now straightforwardly go to Line 57 of this file by this command :
1 | nano +57 /usr/bin/vncserver |
you will see lines like :
1 2 3 4 5 | $defaultXStartup = ("#!/bin/sh\n\n". "# Uncomment the following two lines for normal desktop:\n". "# unset SESSION_MANAGER\n". "# exec /etc/X11/xinit/xinitrc\n\n". |
After that "# exec /etc/X11/xinit/xinitrc\n\n".
, you will add :
1 2 3 4 5 | "gnome-panel &\n". "gnome-settings-daemon &\n". "metacity &\n". "nautilus &\n". "gnome-terminal &\n". |
Now run :
1 | vncserver |
provide password. There is no need of view-only. By default, VNC server instance is on port 5901. Connect using your client software. You should be able to connect. If you can not connect or see desktop via client, you need some fix.
Next part is difficult. It is for making it a service. Run the commands :
1 | nano /etc/init.d/vncserver |
copy-paste it :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | #!/bin/bash ### BEGIN INIT INFO # Provides: VNCSERVER # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start daemon at boot time # Description: Enable service provided by daemon. ### END INIT INFO unset VNCSERVERARGS VNCSERVERS="" [ -f /etc/vncservers.conf ] && . /etc/vncservers.conf prog=$"VNC server" start() { . /lib/lsb/init-functions REQ_USER=$2 echo -n $"Starting $prog: " ulimit -S -c 0 >/dev/null 2>&1 RETVAL=0 for display in ${VNCSERVERS} do export USER="${display##*:}" if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then echo -n "${display} " unset BASH_ENV ENV DISP="${display%%:*}" export VNCUSERARGS="${VNCSERVERARGS[${DISP}]}" su ${USER} -c "cd ~${USER} && [ -f .vnc/passwd ] && vncserver :${DISP} ${VNCUSERARGS}" fi done } stop() { . /lib/lsb/init-functions REQ_USER=$2 echo -n $"Shutting down VNCServer: " for display in ${VNCSERVERS} do export USER="${display##*:}" if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then echo -n "${display} " unset BASH_ENV ENV export USER="${display##*:}" su ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1 fi done echo -e "\n" echo "VNCServer Stopped" } case "$1" in start) start $@ ;; stop) stop $@ ;; restart|reload) stop $@ sleep 3 start $@ ;; condrestart) if [ -f /var/lock/subsys/vncserver ]; then stop $@ sleep 3 start $@ fi ;; status) status Xvnc ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac |
Make it executable :
1 | sudo chmod +x /etc/init.d/vncserver |
Now create another file :
1 | nano /etc/vncservers.conf |
copy-paste it :
1 2 | VNCSERVERS="1:ubuntu" VNCSERVERARGS[1]="-geometry 1024x768" |
ubuntu is username, you can use other name but on in HP Cloud. For HP Cloud, you need the username to be ubuntu for debugging key based ssh. Again make it readable :
1 | sudo chmod +x /etc/vncservers.conf |
Now run :
1 | sudo update-rc.d vncserver defaults |
Now restart the service :
1 | sudo /etc/init.d/vncserver restart |
For Rackspace, there will be no issue. For HP Cloud, it is not only guide which can enable you to view. Honestly you need a bit grasp on unix system. This guide will not need to modify ../,,/.vnc/xstartup
file, still we are providing you a snippet :
1 2 3 4 5 6 7 8 9 | #!/bin/sh unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS startxfce4 & [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic & |
At the end, OS X can directly connect from Safari if you use this format – vnc://ubuntu@I.P.address