How to enable Desktop Experience and enable RDP for a CentOs 7 VM on Microsoft Azure

[bing_translator]Normally when you provision a Linux VM on Microsoft Azure, it's provisioned for you on the CLI mode which most of the Linux fans are fund of it but in case you would like to use the desktop experience and RDP to the machine instead of SSH to it, you will need to follow these simple steps.

Connect to the VM using the SSH command tool like Putty.exe

In the upper putty window you can see that I'm connecting to this "VM" on port 22 which is the default port of ssh, you will need to replace the value of the Host Name and Port with your own, to get this on Microsoft Azure , you will need to navigate to your machine's dashboard on the management portal on Azure, check the screenshot below and obtain the DNS name highlighted below.

After Connecting to the VM on the CLI, you will get prompted to enter your username and password, so go ahead and enter the same username and password you created to access your VM on Azure.

and then run this command to gain root privileges.

# sudo -s

Install EPEL and nux Desktop repository rpms.

# rpm -Uvh

after this is successful, continue by installing the GNOME desktop to get the graphical user interface you desire

# yum groupinstall "GNOME Desktop" "Graphical Administration Tools"

the installation process will take sometime depending on your internet speed, after the installation is done, run the following command to change the reboot from CLI to GUI.

# ln -sf /lib/systemd/system/ /etc/systemd/system/

the next step is to install the xrdp to be able to RDP on the VM

# yum -y install xrdp tigervnc-server

then start the xrdp service

# systemctl start xrdp.service

then test the xrdp service by running the following command, you should see the next screenshot

# netstat -antup | grep xrdp

now you can enable the xrdp service

# systemctl enable xrdp.service

And then add a port in the machine firewall if it was activated, if not then there is no need for the next two commands.

# firewall-cmd --permanent --zone=public --add-port=3389/tcp
# firewall-cmd --reload

Now that we have configured the CentOs 7 VM to have GUI and we have enabled the xrdp service on it, we have only one step left which is only adding an endpoint to the machine on Azure management portal. Go back to the Azure management portal and go to your VM ENDPOINTS Tab, check the screenshot below and then Add a new endpoint by clicking the Addbutton in the task bar on the lower end of the portal.

After clicking on the Add button, you will have the following form where you select from it RDP and choose keep the default values of the port and then click Ok , this will create a RDP endpoint where you can connect successfully to the machine, after the creation is done, you will see a new record added under your ENDPOINTS This is the view after the creation of the endpoint is succeeded

Now you can test the connection to your VM by clicking on connect button in the VM's dashboard task bar

which will download the RDP file to connect to this VM, click connect on it and then you will see this notification which you will have to click Ok

then the RDP window will open with the following screenshot

Enter your credentials here and then you will see the following prompt windows and viola you did it 🙂

Comments (21)

  1. CJ Turner says:

    Why do you need to pull the package(s) from the nux desktop rather than the CentOS/EPEL repos?

    1. Hi CJ, not for a specific reason but I prefer nux as it doesn’t have any dependencies, it works right away versus EPEL that always gave me trouble.

  2. TUYEN M NGUYEN says:

    Thank you very much. It works for me.

    1. You are more than welcome 🙂

  3. Gulab Pasha says:

    Hi Guys,

    How to we set static port connect to xrdp session, I mean where I can use same session when ever I connect to my xrdp.

    Gulab Pasha

  4. Bothwell says:

    many thanks for this, mine is working.

    I would like to ask on how secure the xrdp session is.

    I read here we should create a rsakeys.ini , would you know if this is still necessary or maybe assist on how to do it

    1. Thanks Bothwell, for securing access via xrdp session, try this blog post

  5. Muralidas says:

    I flowed the same link but I am getting blank screen only after login.

    1. Hi Muralidas,

      Just to make sure I got your point, you followed all the steps in the article and you are able to RDP to your linux VM and after you login with your credentials,it gives you a blank screen ? is this what happens ?

  6. Daniel Balaguera says:


    I follow this steps and it works

  7. Nicholas says:

    Thank you k.moussa.

  8. Andrew says:

    I'm trying to do this for a non-classic vm (resource manager). I installed xrdp and created an inbound rule for port 3389, but when I try to rdp it fails. Id there something I'm missing?


    1. Alberto says:

      For resource manager VMs you can create an inbound rule for RDP in the Network Security Group.

    2. Hi Andrew, sorry for replying that late – was on a long business trip, are you able to reach the machine on the public IP or it rejects the connection?

  9. Subhash says:

    I am able to connect the VM via RDP. But after I entered the username/pwd while creating the VM…I was prompted to enter password for the user "Administrator" (to create color managed device). What is the default password ? I never set any username "Administrator while creating.

  10. PJ Gorman says:

    Absolutely fantastic article!

    Begs the question: Why did i have to search Google to find this great msdn article after spending over half an hour poking around in the azure linux VM tutorials.

  11. David Stephenson says:

    Outstanding article!   Got me up and running in less that 15 minutes.  Thank you kmossa

  12. Takashi Uesaka says:

    I had same problem with Gaurav.I checked the status about xrdp by : systemcrl | grep xrdp, the status was faild.

    I used followed command.

    chcon -t bin_t /usr/sbin/xrdp

    chcon -t bin_t /usr/sbin/xrdp-sesman

    and restart xrdp.

    systemctl restart xrdp.service

    Then I suceeded to connecting the VM.

  13. Gaurav says:

    hi ,

    I followed the steps . all the steps worked except this one : netstat -antup | grep xrdp .

    I did not get any statements which you mentioned in the image .

    Secondly I am able to use Remote desktop for connecting the VM . Its showing the same error message. Can you suggest something ?



  14. David R Sachs says:

    I was able to follow the exact instructions above and reproduce Karishma's error "Oh no! Something has gone wrong…"

    I was able to get to the desktop after troubleshooting. I had a number of suspect causes, but I believe the fix was one (or both) of the following:

    1) sudo yum update

    2) sudo adduser <username>

    sudo passwd <username>

    (assign password for newly created user)

    …I connected to my host via (x)RDP with the new user creds I had created. The desktop session connection was successful.

    (Note: I have not used the desktop extensively yet.)

  15. Karishma says:

    Hi k.moussa,

    I followed the exact steps and login to rdp, but i get a screen with a sad pc image saying:


    Oh no! Something has gone wrong.

    A problem has occurred and the system can't recover.

    Please log out and try again.


    What is missing here?

Skip to main content