How to install/enable GUI on Debian VPS using VNC

Mostly VPS don’t come with GUI, but what if you want GUI desktop and want to enable it in your hosted VPS.
Here is a method to do that using VNC server.
Virtual Network Computing (VNC) is a graphical desktop sharing system that uses the Remote Frame Buffer protocol (RFB) to remotely control another computer.

Using VNC  you can connect to GUI hosted on your for easy remote management.
Below steps will walk you through setting up VNC server on your Debian VPS.
Firstly make sure you are logged in to your VPS as a root user.Now run the below commands.

# apt-get update
# apt-get upgrade

1. Command to install GNOME

#apt-get install gnome-desktop-environment

2. Installing fonts:

# apt-get install xfonts-100dpi
# apt-get install xfonts-100dpi-transcoded
# apt-get install xfonts-75dpi
# apt-get install xfonts-75dpi-transcoded
# apt-get install xfonts-base

3. Now lets install a VNC server namely TightVNCServer using below command

# apt-get install tightvncserver

4. Starting Tight VNC Server for the first time,will copy config files and prompt  for a password:

# tightvncserver :1

5. Stop the VNC server, so we can continue to configure it:

# tightvncserver -kill :1

6. Edit the xstartup file:

# vi ~/.vnc/xstartup

Press “A” to enter edit mode. Replace the contents of the file with the following (or edit to match):

#!/bin/shxrdb $HOME/.Xresources
xsetroot -solid grey
x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
# x-window-manager &
gnome-session &

Press ESC, type :wq, then press enter to save and close the file.

7. Now start the VNC server with your desired resolution:

# tightvncserver -geometry 1024×768 :1

Now try accessing your server’s remote GUI with a VNC client/viewer.

Enter your VPS IP address, port 1 or 5901, and enter password you set earlier to connect to desktop.
This entry was posted in computer tips and tricks, computernetworking, linux. Bookmark the permalink.