
10 min read
FONT:
Aug 1, 2022
Virtual Desktop Infrastructure or VDI in short, is the ability to connect remotely to another machines with a fully supported GUI and I/O devices.
Probably you have heard long and complicated explanations about this before. In this 3 parts series of articles I’ll discuss about VDI in simple words, give examples of VDI use in cloud and will show how to build VDI servers in an automated process with Packer.
In this article I will discuss about concept of VDI and will guide you through a step-by-step guide to create you own VDI machine in AWS cloud using Ubuntu Linux and RDP remote desktop protocol.
In the 2nd article I will talk machine images and Packer, a tool used to automate machine images. I will give an example for using Packer to automate creation of VDI machine images.
In the last article I will show you an example for a real VDI project done by me while working in Develeap for one of its largest customers, showing the challenges which we faced and how we solved them. I w
Virtual desktop as infrastructure (VDI) in simple words
Virtual desktop as infrastructure (VDI) is having the ability to login and graphically use a remote server as if it was a desktop machine. That is, to seamlessly use a remote server with a desktop GUI connected to your local keyboard, mouse and screen connected to your local computer. In other words, VDI is a remote server which is doing calculations using its own CPU and RAM, while the input and output devices shared and connected to it are from your local machine.
In this configuration the remote server feels like a local machine — you can install on it any application you need, including things like a web browser or a graphical game. The server can include any modern technology such as JAVA JVM, Python interpreter or C++ libraries — which gives an endless variety of options. As the server includes a GUI, you can also run graphical applications too.

The basic requirements to share of your input and output devices from your local machine with the remote server is done using a remote desktop solution client application. The remote desktop solution allows sharing the computer input and output devices with the server. You can share “classic” I/O device like a screen, a keyboard or a mouse but also other devices such as a printer, a video camera, volume speakers and even a smart card reader!
The server is required to run an operating system which is capable of handling remote sessions, and a server application/daemon process to actually accept client’s sessions requests, authenticate and handle them.
Both client application on you local machine and server application/daemon must support same remote desktop protocol.

Advantages of VDI:
Basically you can run almost any application on-premise, but using a VDI remote server can be a considerable choice in some use-cases. Running your application remotely in cloud can have extra benefits such as high internet speed, pay-on-need for resources and high-security and reliability.
Below are two lists covering some of the advantages of running an application remotely, as well as running the remote server on cloud.
Advantages of using VDI as a solution for hosting your application –
- Accessibility — you can connect to the server from any location — as long as you have network connectivity.
- No dependency between physical local machine and the remote server — your server can run a different environment regardless of your local machine.
- No need to maintain physical devices to connect to your server — the server can stay anywhere you want — no need to have a dedicated desk, mouse, keyboard and screen for it.
I want to sharp the difference between running the application locally and remotely using VDI:
When running the application locally — it runs on your OS with the local configurations and machine resources. With VDI a remote server can run your application with a different CPU architecture regardless of the user’s desktop machine. The application will use resources from the server itself and and not from your local machine. Only resource taken from your local machine are for running the remote desktop client.
Advantages of using VDI on cloud platform –
- Fast access to cloud provider services — as the server is located within the cloud computing center, the physical distances are short, so any communication from your server to other application or Cloud fully-managed services will benefit from a high network speed.
- Pay as you go, scale-up as needed —you can change the server’s capabilities according to your need and pay-as-you-go. Just to compare, in reality if you need to replace your desktop machine — you will have to replace the whole machine which is very expensive.
- High-connection internet speed — the server is located in a servers farm with a high internet connection –much faster than the user’s house. This is quite useful in case you want to traffic big amounts of data to your application.
- Advanced back-ups — cloud provider offers advanced back-up systems which can allow efficient, chip and real-time back-up.
- High availability— computing centers have advanced power backups and disaster recovery technologies.
- Better data security — all data is processed on the server itself, without leaving it. Also the server can enjoy the enhanced network security features available on cloud platforms.

Importance of good and stable internet connection –
The main disadvantage of VDI is the need for a stable and fast internet connection from the user’s house/office to the server. Generally a remote connection will require a minimum of 2–5Mbps connection speed and up to 10–15 Mbps, depending on usage and remote desktop protocol being used.
VDI — Behind the scenes:
Generally VDI can be done with all major operating systems (Windows and Linux family) — but for this example I will choose Ubuntu Linux as a model.
For the server to serve remote desktop sessions, it requires to have some sort of desktop GUI installed (Gnome, KDE… ) and a remote desktop solution daemon running which allows to share I/O devices between client’s machine and the server. Once you have that, the remote server is able to serve users clients requests and to manage remote sessions.
Which existing solutions are in market?
There are many remote desktop solutions in the market such as VNC, RDP , NICE DCV, VMware and the list continue. There are many clients which support the various solutions.
It is to note that there are already made out the box VDI solutions which are more easy to manage, to scale and to provision multiple servers for multiple users.
What is a desktop GUI?
Before watering our hands, let’s start with answering these two basic most questions –
- What is the difference between the large varieties of Ubuntu desktop versions — Ubuntu, Lubuntu, Xubuntu, Kubuntu etc.. ?
- What is the difference between Ubuntu server and Ubuntu desktop versions?
The answer for both questions is the installed packages included in each version.
An Ubuntu desktop machine includes the Linux kernel along with many other packages and installations including and not only — a terminal shell, a firewall, drivers, a GUI desktop, and some applications to be used by the user such as a web browser.
Now let’s answer on the 1st question — Ubuntu can support multiple types of GUI desktop solutions — each one has different requirements, applications installed, style and performances. There are multiple versions of Ubuntu each one using a different desktop solution — XFCE desktop is used by Xubuntu, LXQt desktop by Lubuntu, GNOME desktop by Ubuntu “default” popular version.
As for the 2nd question — Ubuntu server is like a light-weight version of the desktop version with no GUI desktop installed — it includes only what needed to run on a server. That is —on a server you don’t need a GUI, you don’t need Firefox or OpenLibre, a media player and many other things which mostly you would like on your personal computer. In vice-versa — you can think about Ubuntu desktop as an extended version of Ubuntu server with more installations which gives the user a better experience and more functionality.

Creating a VDI Ubuntu Linux server in AWS cloud using Ubuntu server and RDP:
After explaining the concepts — let’s try to create a VDI machine.
We will create a remote desktop server in AWS cloud using Ubuntu server 20.04 . We will install GNOME desktop which is the desktop install on Ubuntu “default” desktop distribution.
For this example, I chose working with “remote desktop protocol”, or RDP in shorts. ( In its Linux adaptation it is known as xRDP ) I chose it because it is easy to install and has a wide range of clients. There are many available users’ clients available for free — for Windows, Mac and Linux.
To note, the concept and instructions should be almost the same for any cloud provider (or on-premise server) and other Linux distributions. Also, managing a VDI server with a remote desktop solution other than RDP will work in a similar way to the one I’ll show below.
Steps:
- Spin an EC2 virtual server with Ubuntu server version 20.04 .
- When creating the EC2 instance make sure to assign it a security group which is open for port 22 (to SSH to the instance) and port 3389 which is used by RDP protocol for contacting the remote server.
3. Wait for the server to be up and running — and connect to it using SSH.
4. Update the apt package manager so we can install a GUI and RDP package
$ sudo apt update
5. Install a GUI solution along with necessary dependencies. For this example the following command will install GNOME desktop GUI which is the default Ubuntu desktop. Note the command below installs a minimal version of GNOME desktop with almost nothing, you can install other GUIs which include all pre-installed applications which generally come with Ubuntu.
# Option 1 - will install a minimal version of GNOME desktop$ sudo apt install gnome-session gdm3
# Option 2 - will install the ubuntu GNOME dekskop with all default applications. Bear in mind that it will require more volume!$ sudo apt-get install ubuntu-desktop
6. Install xRDP server application. When installed, xRDP has automatically created a user named “xrdp” in the operating system called which will run the RDP server application in the background.
$ sudo apt install xrdp -y
7. xRDP uses the SSL-cert manager for securing the authentication between the servers and clients connecting to it. You need to grant the “xrdp” user permissions to access the SSL-cert manager.
$ sudo usermod -a -G ssl-cert xrdp
8. Now restart the xRDP service and make sure it is running.
$ sudo systemctl restart xrdp
$ sudo systemctl status xrdp

9. Open the OS firewall to port 3389 which is used by xRDP protocol.
$ sudo ufw allow 3389
$ sudo ufw reload
10. At this point we have a GUI and RDP installed – all we need is a user with a password in order to login. we can use default created “ubuntu” user by setting it a password but it has sudo permissions and we should prefer a new user with less permissions. Create a new user in the OS and assign it a password.
$ sudo useradd -m <username>
$ sudo passwd <username>
That’s it! You can now login form your machine to the remote server using any remote control client which support RDP protocol.
Compatible RDP clients are available on all major OS — for example: In Windows you can just search for “remote control” on the start-up menu , in Mac you can download the remote desktop application from the App Store and in Linux you can use Remmina client.
Open your RDP client, on server address fill in the EC2 instance public IP address and later insert the username and password you just set.
I want to note that sometimes you can have troubles connecting because of graphical drivers – an over-pass for this issue is to try and reduce the screen resolution or color-depth in your RDP client configurations.

Test and play:
Check your physical location from within the remote session — you will be shown the server’s location and not your local machine’s location.

Now let’s try to do a network speed test on our local machine and on the VDI server — see the high speed and low latency!

Now for the gist of it let’s install firefox and try to watch YouTube via the remote server.
$ sudo apt install firefox
How can we go far from here?
So that is a basic proof of concept on how to create a VDI remote Linux server. It is to note that we can use other OS or distributions such as Debian Linux or Windows to act as a remote server with other remote desktop solutions.
So how can we go far from here?
- We can and should make it more secure — like limiting access through VPN only.
- We can do some nice DevOps work here — making a whole automated CI/CD pipeline which can create a VDI remote server with needed applications and configurations already pre-installed.
- We can scale the amount of servers — having hundreds of servers running in parallel — serving hundreds of different users.
