Create a Linux Ubuntu Virtual Machine in Azure with Xfce Desktop

In this article, we will see how to create a Linux virtual machine with Xfce desktop step by step. Xfce desktop is very lightweight and easy to use for a Windows user.

Log in to the Azure portal

Create a resource and choose Ubuntu Server 17.10

Give a valid name to your VM and user. Then choose Authentication type as Password as in the image. If you choose SSH public type, provide an RSA public key in single line format. (It is more complicated than giving a password. So I chose Password authentication.)

Choose the size of the hard disk and the number of cores for our VM.

I have a selected a plan of 32 GB SSD disk size and 16 GB RAM.

Select HTTP, SSH (22) and RDP (3389) ports in public inbound ports so that we can connect this VM using RDP (Remote Desktop Protocol) and SSH (Secure Shell, used for PuTTY connection).

Remaining configuration is showing in the portal.

After successful validation the below screen will appear.

Now, you can click the Create Button.

After some time our VM will be created successfully. If you check all resources, we can see a total of 7 resources as shown below.

We can see one store account, one virtual network, one disk, one network interface, one public IP address and the network security group.

If you check in the inbound port rules in the networking tab, we can see below rules are added.

Now, our VM is ready to connect with RDP and SSH.

(Please note, if you have not created inbound port rules for SSH and RDP please create it using a portal or Azure CLI)

Now we are going to connect our VM using PuTTY client and install our Xfce desktop. For this, we need a PuTTY client. Please download this from below URL.

 

 

After successful installation, please open PuTTY.

To connect PuTTY, you need IP address of your VM. You can get it from the overview pane.

Copy the IP address and paste in PuTTY hostname.

After clicking the Open button, it will show a security warning screen as below.

This is for SSH key creation and it will ask the only first time. Please click yes button and proceed.

Now, the PuTTY login screen will open and you can enter the correct username and password as we gave in the VM creation.

Now, our Ubuntu terminal will be shown as below.

Now, we are going to install the Xfce desktop.

Xfce is a lightweight desktop for Linux operating system.

You can get more details of Xfce from this website. Xfce Desktop

Please type below command in the terminal.

sudo apt-get update

This will check the latest version of Ubuntu and will install it from the global repository.

Now, we are going to install Xfce the desktop.

Please type the below command in the terminal.

sudo apt-get install xfce4

As we know, Xfce is a package and needs additional disk space. So it will ask for a confirmation like below.

Please choose y.

Now, that you have a desktop environment installed, configure a remote desktop service to listen for incoming connections. xrdp is an open source Remote Desktop Protocol (RDP) server that is available on most Linux distributions and works well with Xfce. Install xrdp on your Ubuntu VM as follows:

sudo apt-get install xrdp

Tell xrdp what desktop environment to use when you start your session. Configure xrdp to use Xfce as your desktop environment as follows,

echo xfce4-session >~/.xsession

Restart the xrdp service for the changes to take effect as follows:

sudo service xrdp restart

One more step — you need to establish a remote connection.

To change access from root only to all users we simply edit the file /etc/X11/Xwrapper.config

This can be done by using an editor such as nano to manually change the line allowed_users=console to allowed_users=anybody.

Alternatively, it can also be updated by running the following command to make the changes.

sudo sed -i ‘s/allowed_users=console/allowed_users=anybody/’ /etc/X11/Xwrapper.config

You can connect our Linux VM from any of the Windows systems using RDP connection. For that, you can download the remote connection shortcut from the Azure portal.

Please click the Connect button in the overview pane and choose the RDP section as given below.

Double click the RDP shortcut file and open.

It will ask for the username and password. Please give the correct details.

Finally, our Xfce desktop is ready to use.

You can’t directly move files from your windows system to Linux VM. For that you can use WinSCP software or you can even use PuTTY.

Please follow and like me:

2 thoughts on “Create a Linux Ubuntu Virtual Machine in Azure with Xfce Desktop

  1. folorentorium Reply

    Attractive section of content. I just stumbled upon your web site and in accession capital to assert that I get actually enjoyed account your blog posts. Any way I’ll be subscribing to your feeds and even I achievement you access consistently rapidly.

Leave a Reply

Your email address will not be published. Required fields are marked *