I have a VPS running with Ubuntu 18.10 Server. I want to install a desktop GUI there, but I can't use or access the desktop environment on the actual physical machine (obviously, since it's just a VPS, running on some remote location).

Upon searching I find many answers like:
sudo apt install ubuntu-desktop
sudo apt install xvnc4viewer
or related stuff involving Gnome or X11 or tons of other options.

All these do seem to install desktop or GUI related things. But I am completely clueless as how to actually start or connect or access these from my own machine.

How do I setup and connect to the remote desktop, to operate the GUI on the VPS from a different location?

By the way I'd prefer to access the GUI from my Macbook (macOS 10.14 Mojave). Is that possible, or do I need to have an actual Ubuntu desktop machine, in order to access the remote Ubuntu server that is running the virtual desktop?

  • has the VPS a vnc server? – emvidi Mar 14 at 12:05
  • @emvidi Not that I know of. Unless that's something that comes with Ubuntu 18.10 server by default? – RocketNuts Mar 14 at 23:54

On the VPS install

sudo apt update
sudo apt install tightvncserver

you will be asked to set a password which you will need later. Then start the server with the command


and you should see something like

New 'X' desktop is (vps-name):1

(vps-name) is the name of your machine, important is the session number after the colon.

Now on mac download a free vnc viewer, I have tested Remote Desktop - VNC which is free on the App store and is pretty decent. Ok now you need to execute this on your mac Terminal

ssh -L 5901:localhost:5901 -N -v user@vps-address

user - your user for the ssh
vps-address - the address or ip of the vps

The number after the colon earlier is what you put after 590 which is 1. If it where 2 then would be 5902:localhost:5902. Now start your vnc viewer and type into the address field, remember the number after the colon,

localhost:5901 or localhost:5902 

and then you should be asked for the password you setup on the tightvncserver earlier. This is an encrypted connection through ssh to your VPS. When you are done just close the viewer and kill the ssh connection in the Terminal (ctrl-c).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.