When you deploy a new Linux Virtual Machine in Microsoft Azure, you can only connect to using SSH. The reason is Linux Virtual Machines do not support Remote Desktop (RDP) natively. It means that you must allow the 22 port number in the Network Security Group. Sometimes, it can be useful to enable RDP on a Linux Virtual Machine, so in this article, I will explain how to setup a Linux Virtual Machine in Azure with RDP access that you can use for testing purposes.
To enable RDP on the Linux VM, I will use the xrdp project which is an open source project that added Remote Desktop Protocol (RDP) support to Linux machines. The xrdp project let you connect to the Linux machine with a graphical user interface.
Setting up a Linux VM in Azure
The first thing to do is to deploy a new Linux Virtual Machine from the Azure Marketplace. Open the Azure portal and navigate to the Marketplace, select “Ubuntu Server”:
Next, enter the information required about the Virtual Machine, such as:
- the subscription,
- the resource group,
- the name of the VM,
- the region where the VM will be located,
- the size of the VM
Then, select the authentication type between password and SSH key. Here, I choose username + password. Before validating the process, you must allow the following ports in the NSG:
You can review the configuration and close the wizard by clicking “Create”
Connect to the Linux VM with Remote Desktop Client
Open the Virtual Machine blade and click “Connect”. You need to select “SSH” because RDP is not enabled. Download a SSH client such as “Putty” and connect to the VM using the information
We must install LXDE using the following command:
|
sudo apt-get install lxde -y |
Then, install the xRDP project using the following command:
|
sudo apt-get install xrdp -y |
Next, we need to start the xRDP service using the following command:
Ok, everything is ready, so we can try to connect to the VM using the RDP access. Go back to the Virtual Machine blade and select “Download RDP File”:
Run the RDP file and confirm that the following window appears:
To finish, you just need to enter the credentials created during the provisioning wizard:
Related materials:
Views All Time
1
Views Today
2
Return to all postsThe following two tabs change content below.
Filed under:
Software by Nicolas Prigent