Introduction
In this blog post, we will explore the process of setting up and connecting to an Ubuntu virtual machine (VM) in Microsoft Azure using Remote Desktop Protocol (RDP). Whether you work in IT, develop software, or simply love Linux, this guide will provide you with the knowledge and steps needed to establish a remote desktop connection to your Ubuntu VM in Azure. By following these instructions, you’ll gain greater flexibility and convenience in accessing your Ubuntu environment remotely.
Configuring the Ubuntu VM
First let’s install Ubuntu VM in Microsoft Azure using the Portal.
- Search for Virtual Machine in Azure Portal and Select it.
- Click on Create and Select Azure Virtual Machine
- First step of configuring Basic:
- Resource Group
- Virtual Machine Name
- Region
- Ubuntu Image (I’m using 22.04 LTS)
- Second step of configuring Basic:
- Select the Size you want the VM to run.
- In this case, I’m using Password as my authentication.
- Allowing SSH port
- Keeping the Disk Settings by Default and Moving to Network
- Please refer to my Virtual Network Configuration Article for more details
- After Configuring click on Review + Create
- After you pass the Validation Check, click on create
Accessing the VM using SSH
- After the Deployment is completed, Grab the Public IP from the Dashboard.
- Go to your Windows Terminal, Type the command and enter your password in the prompt.
ssh jd@public-ip
- You will see the Ubuntu Terminal.
Install and Configure Remote Desktop
- First install xfce
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install xfce4
sudo apt install xfce4-session
- Install XRDP
sudo apt-get -y install xrdp
sudo systemctl enable xrdp
- On Ubuntu 20, you need to give certificate access to an xrdp user:
sudo adduser xrdp ssl-cert
Tell xrdp what desktop environment to use when you start your session.
Configure xrdp to use xfce as your desktop environment:
echo xfce4-session >~/.xsession
Restart the xrdp service for the changes to take effect:
sudo service xrdp restart
Check the status of xrdp:
sudo service xrdp status
Now we have to allow RDP port in Network Security Group
- Click on Networking and Select Add inbound port rule
- Click on Service and Select RDP, which will autofill the rest.
- Now Open the Remote Desktop Connection and type the Public IP
- Use the Ubuntu Linux Credentials and login
Summary
In this blog post, we explored the process of setting up and connecting to an Ubuntu virtual machine (VM) in Microsoft Azure using Remote Desktop Protocol (RDP). By following the step-by-step instructions provided, you can establish a remote desktop connection to your Ubuntu VM, allowing for convenient access and management of your Ubuntu environment.