Originally Published on sunnykrgupta.github.io This blog is intended for people who wanted to install GUI or desktop environment on linux running on and connect. servers cloud We are going to use VNC (Virtual Network Computing) protocol for accessing our remote desktop server. What is VNC ? , or VNC, is a graphical desktop sharing system that allows you to control one computer remotely from another. A VNC server transfers keyboard and mouse events, and displays the remote host’s screen via a network connection, which allows you to operate a full . Virtual network computing desktop environment Basically ubuntu server and ubuntu cloud editions does not contains GUI, which needs to be installed before installing VNC server. Please note that server and cloud editions are carefully designed to utilize less hardware resources ( minimal environment ), installing GUI might leads to high hardware utilization. Why I needed desktop environment in remote server ? Just to explain a use case, let me tell you how I ended up using VNC in first place. I was working on a problem which relates with cloud latency testing. My Friend, developed a javascript code that makes an cross origin call to a near to the geographical location of browser and response will be delivered from loadbalancer in geographic proximity. To test this setup, executing JS code and to use to see what’s happening under the network layer, we were in need of a browser engine in different geographical location. I could have used some online paid or free service to get browser rented, services like or other alternatives but that has free minutes based trial restrictions. Neeraj (whose work revolves around core JS research & development) HTTP API loadbalancer developer console browserstack Install a Desktop and VNC Server on Ubtunu 14.04 Step 1 — Install Ubuntu desktop Start installing below which helps VNC to load properly . These packages are required for all editions including . gnome packages ubuntu desktop $ sudo apt-get install --no-install-recommends ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal gnome-core Step 2 — Install vnc4server package. $ sudo apt-get install vnc4server Step 3 — Make configuration changes in vncserver Open file and edit as follows . Before editing, make a backup copy. /usr/bin/vncserver $ sudo cp /usr/bin/vncserver /usr/bin/vncserver.bkp $ sudo vim /usr/bin/vncserver #Find this line "# exec /etc/X11/xinit/xinitrcnn". #and add these lines like below "# exec /etc/X11/xinit/xinitrcnn". "gnome-panel &n". "gnome-settings-daemon &n". "metacity &n". "nautilus &n". "gnome-terminal &n". Step 4 — Start your vncserver Now type the command to start VNC session. you will be prompted for creating new vnc password. vncserver $ vncserverYou will require a password to access your desktops through VNC Clients.Password:******Verify:****** xauth: file /root/.Xauthority does not existNew 'ubuntu-desktop:1 (root)' desktop is ubuntu-desktop:1 Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/ubuntu-desktop:1.log Step 5 — To check VNC server has started, follow $ netstat -tulpn Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 28372/Xvnc4tcp6 0 0 :::5901 :::* LISTEN 28372/Xvnc4 VNC server is running and listening on . Make sure your firewall allows TCP connection to this port. 5901 port inbound Step 6 — Configure your Firewall If is active, you need to open ports for inbound communication. If no firewall is enabled, you can skip this section. firewall $ sudo ufw allow OpenSSH #allow SSH $ sudo ufw allow 5901/tcp #allowing single port 5901 port $ sudo ufw allow 5901:5910/tcp #To allow series of port 5901 - 5910, follow $ sudo ufw status verbose #To check firewall rules Status: activeLogging: on (low)Default: deny (incoming), allow (outgoing), disabled (routed)New profiles: skip To Action From-- ------ ----22/tcp (OpenSSH) ALLOW IN Anywhere5901:5910/tcp ALLOW IN Anywhere22/tcp (OpenSSH (v6)) ALLOW IN Anywhere (v6)5901:5910/tcp (v6) ALLOW IN Anywhere (v6)WW Good reads on configuring UFW firewall Step 7 — Connect to VNC Server Use any remote desktop connect client that allow VNC protocol. Use of server along with port where VNC server is listening. IP address Connect -Remote Desktop Viewer Once connected to your VNC server, you will see screen of remote server where you installed desktop GUI. Launch Firefox from Terminal Browser screen running on remote server. Google UK That’s it, your VNC server is working. Here I created my linux server in london, UK. I opened firefox through terminal to reach out to URL google.com. It opened google.co.uk domain based on regional search engine. You can do lot of other stuffs on VNC protocol to get things done from remote location. Daemon Blog : https://sunnykrgupta.github.io/installation-of-vnc-server-on-ubuntu.html _Posts and writings by Sunny KUMAR_sunnykrgupta.github.io Daemon Blog - Installation of VNC server on Ubuntu