Standing Up an Ubuntu Linux VM in Azure
Standing Up an Ubuntu Linux VM in Azure
Learn to set up an Ubuntu Linux box on the Azure cloud platform as the basis for a Linux sandbox on which you can set up further containers to run applications.
Join the DZone community and get the full member experience.Join For Free
The new Gartner Critical Capabilities report explains how APIs and microservices enable digital leaders to deliver better B2B, open banking and mobile projects.
This article will walk the user through the detailed steps necessary to set up and run an Ubuntu Linux box on the Azure cloud platform. This article will be the basis for users to set up a Linux sandbox on which we could set up further containers and use those containers to run Mule applications.
2.0 Setting Up the Ubuntu Linux Box
First, you need to log into the Azure portal. Upon logging into the Azure portal, you will see the following screen (depicted in Figure 2.0a).
Click on the plus sign (+) at the top left corner of the screen. Then click on "create Ubuntu server," as highlighted in Figure 2.0b.
In Figure 2.0c, you will be prompted to key in some server details; key in the name of the server in the first text box, then retain the default VM disk type. The third text box will be the root user name that you will be using both for SSH putty and also for the remote desktop later; choose the authentication type as "password." The following list box would be a subscription that you are on; select a valid subscription. Following that would be the resource group. If you don't have an existing resource group, create one. The last text box is the location text box; choose the correct location that would be closest to your place of residence. As I am trying to connect from New Zealand, I have chosen the location to be “Australia Southeast.”
After keying in all fields, click on OK and you will be brought to a page depicted by Figure 2.0d.
Select an option from Figure 2.0d that would fit your computing needs. For demo purposes, I have selected the option with the least computing resource. When you click "select," you will be brought to screen Figure 2.0e; for cost conservation, remember to select the Auto Shutdown option and specify the time for the auto shutdown to happen.
When you click OK, you will be brought to the purchase screen; click to accept the agreement and you will proceed to the following screen (Figure 2.0f).
Here you just need to wait for a few minutes for the server to be booted up. This is the time where you will need to download and install Putty if you don't have it running on your machine. Once your application is up and running, you will see the following screen (Figure 2.0g)
At Figure 2.0g, click on the IP address as per highlighted. You will be brought to another configuration screen (Figure 2.0h); here, key in the host name and click "save."
We are configuring the hostname so that we don't need to use the IP address for both Putty and also to the remote desktop to the Linux server. Upon successful configuration, if you click back on the overview menu, you will see the DNS name; this is the hostname that you can use for Putty and the remote desktop to the Linux server (depicted in Figure 2.0i).
3.0 Putty SSH Connection to Set Up Linux Box
Cut and paste the DNS name string in Figure 2.0i to the host name text field at the Putty Screen at Figure 3.0a and click on the Open button.
The first time connecting to the server using Putty, you will get the following screen (Figure 3.0b).
On the second connection or any other subsequent connection, the pop up at Figure 3.0b will not appear again, just click on the "yes" button. Next, you will be prompted for the username and password that you previously configured in Figure 2.0c. Upon a successful login, you will see the following screen depicted in Figure 3.0c.
Once you see this screen, it is time to update the Ubuntu distribution. You need to type in the following command:
sudo apt-get update
When the update is finished, you will see the following screen:
Now run the following command:
sudo apt-get install ubuntu-desktop
Key in “Y” when prompted (as depicted in Figure 3.0d) and installation will commence. You will need to wait for 30 minutes for it to finish the installation.
When installation of Ubuntu Desktop is done, you need to run the following command to install XRDP so that we could remote desktop to the server:
sudo apt-get install xrdp
Once XRDP is successfully installed, run the following command to start the rdp daemon. Without starting the XRDP daemon/service, users cannot remote desktop to the Linux box.
Execute the following command to start up the rdp service at the Linux box:
sudo /etc/init.d/xrdp start
If the command executes successfully, you will get the following screen (Figure 3.0f), with a green OK started status.
The following command is for restarting XRDP:
sudo /etc/init.d/xrdp restart
Now you will need to execute the final command to reboot the server:
sudo shutdown -r now
You need to restart the server for all the changes to take effect. Remember to start up XRDP after the server reboot.
4.0 Adding RDP Port to the New VM
After starting up the XRDP service, you now need to head back to the Azure portal to open the port for XRDP connection. Go back to the Azure portal, select the Linux box, and go back to the overview screen. From the overview screen, select “Network Interface” (Figure 4.0a).
Next, click on the highlighted security group in Figure 4.0b.
Now click on the Network Security group and click on the hyperlink displayed on the right pane at figure 4.0c
Now click on inbound security and click on "add" (Figure 4.0d).
Next, add port 3389 for XRDP in the following depicted pop up screen (figure 4.0e) and click save.
Upon successful addition of the port, your screen should look like Figure 4.0f.
5.0 Remote Desktop Connection to the Linux Box
If you are using a windows environment as I am, bring up the remote desktop connection dialog and cut and paste the DNS name from figure 2.0i, to the computer text box at Figure 5.0a.
Upon a successful connection, you will be prompted with an XRDP login screen (depicted in Figure 5.0b).
Once you are successfully in, you will only see darkness. Don’t worry, this is because the UNITY desktop manager is not started. You need to right click and select "open terminal."
Once the terminal is opened inside the remote desktop, I want you to type in the following command and press "enter."
Type this command and press enter:
When unity desktop manager is successfully started, you will see the following screen:
This concludes this article. Stay tuned for the coming ones, as we will explore setting up Docker in the Ubuntu box.
Opinions expressed by DZone contributors are their own.