AWS

How to Enable GUI in Ubuntu AWS EC2

Graphical User Interface (GUI) is developed for the user to ease their understanding of the system with the help of icons, buttons, menus, etc. Amazon EC2 service allows the user to create instances using Linux/Ubuntu Machine Images provided by the platform. Users can enable the GUI of Ubuntu on the Amazon cloud by configuring it using the EC2 instance and setting it up on the RDP server.

Let’s start enabling GUI in Ubuntu AWS EC2.

Enable GUI in Ubuntu AWS EC2

To setup Graphical User Interface (GUI) in the Ubuntu EC2 instance, head into the EC2 dashboard and click on the “Launch Instances” button:

Type the name of the instance and select “Ubuntu” from the Quick Start section:

Scroll down the page to select the instance type and click on the “Create new key pair” link:

Type the name of the private key pair and click on the “Create key pair” button to download the file on the system:

Scroll down to the Network section and add a new security group rule to open the RDP port number 3389 from anywhere on the internet:

Review the configurations from the Summary and click on the “Launch Instance” button to create the EC2 instance:

Select the instance from the list on the Instances page and click on the “Connect” button:

Copy the command to connect to the EC2 instance from the page:

Start the Window terminal and paste the command copied from the platform and change the path of the private key pair file from the system:

ssh -i "C:\Users\Lenovo\Documents\PKPF.pem" [email protected]

Note: You need to change the complete path according to your Machine.

Running the above command will connect the user to the Ubuntu machine:

Use the following command to update and upgrade the apt packages on the Ubuntu:

sudo apt update && sudo apt upgrade

Running the above command will display the following output:

Type the following command to change the password authentication on SSH:

sudo sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config

Run the following command to restart open ssh server:

sudo /etc/init.d/ssh restart

Use the following command to set the password for the Ubuntu machine:

sudo passwd ubuntu

The above command will prompt the user to set the password twice and press enter to save the password:

Type the following command to install the RDP server to set up GUI on Ubuntu:

sudo apt install xrdp xfce4 xfce4-goodies tightvncserver

Running the above command will display the following output:

Use the following command to install the “xsession” file to the home directory:

echo xfce4-session> /home/ubuntu/.xsession

Use the following command to copy the “etc/skel” file to the home directory:

sudo cp /home/ubuntu/.xsession /etc/skel

Use the following command to edit the “xrdp.ini” file:

sudo sed -i '0,/-1/s//ask-1/' /etc/xrdp/xrdp.ini

After that, run the following command to restart the xrdp server:

sudo service xrdp restart

Running the above command will display the following output:

Once the RDP is configured in Ubuntu machine, simply copy the public IP address of the EC2 instance from the platform:

Start the remote desktop File from the system and paste the IP address and click on the “Connect” button:

Connecting to the RDP will prompt the user to enter “username” and “password” and click on the “OK” button:

The Ubuntu GUI is displayed on the screen:

You have successfully enabled the GUI in the Ubuntu EC2 instance.

Conclusion

To set up the Graphical User Interface on the Ubuntu EC2 instance, simply create an EC2 instance from the AWS platform. Connect to the EC2 instance by typing the command provided by the platform and changing the path of the key pair file from the system. On the Ubuntu machine, configure the RDP server to set up GUI in the Ubuntu EC2 instance. Start the RDP file and connect to Ubuntu using the IP address of the instance to check the GUI of Ubuntu.

About the author

Talha Mahmood

As a technical author, I am eager to learn about writing and technology. I have a degree in computer science which gives me a deep understanding of technical concepts and the ability to communicate them to a variety of audiences effectively.