When using AWS, you may need to be able to remotely access the desktop of the Linux VM instances. You can achieve this using XRDP VNC connection. Following the steps below you can install XDRP and Gnome GUI.
There are three sections involved in the whole setup. Follow all the three sections explained below to successfully configure the GUI.
Installing GUI Components
1. Update the server using the following command.
1
|
sudo yum –y update
|
2. Install the gnome GUI components using the following command.
1
|
sudo yum groupinstall –y “Server with GUI”
|
3. Issue the following commands to start the GUI during boot.
1
2
|
sudo systemctl set–default graphical.target
sudo systemctl default
|
Now we have all the essential GUI components installed on the server. In the next section, we will install the xrdp components to enable remote desktop connections.
Recommended: Learn Linux in 5 Days and Level Up Your Career Udemy Course
Setting Up XRDP
1. Add the xrdp repository to your instance using the following command.
1
|
sudo rpm –Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
|
2. Install xrdp and tiger VNC server.
1
|
sudo yum install –y xrdp tigervnc–server
|
3. Setup SELINUX security using the following commands.
1
2
|
chcon —type=bin_t /usr/sbin/xrdp
chcon —type=bin_t /usr/sbin/xrdp–sesman
|
4. Start and enable the xrdp service.
1
2
|
sudo systemctl start xrdp
sudo systemctl enable xrdp
|
5. Enable RDP port on the instance using the following firewall commands.
1
2
|
sudo firewall–cmd —permanent —add–port=3389/tcp
sudo firewall–cmd —reload
|
6. Set a password for ec2-user . This password will be used to connect to the RDP session.
1
|
sudo passwd ec2–user
|
7. Set password for root as you will be prompted for cloud user password for network proxy and color. Login as root and set the password.
1
2
|
sudo su
passwd
|
Now we have the xdrp components and all instance level settings in the right place. Now let’s test out the RDP connection from an RDP client. In this tutorial, i am using windows RDP client.
Connecting The Instance Using RDP
Note: Make sure you have opened RDP port in your instance security group.
1. Open RDP client and type in the public IP of your instance and click connect.
2. If you get a warning message about remote identity, just click yes.
3. Now you will get a xrdp authentication window, enter the credentials and click ok.
Note: The username is “ec2-user” and the password is the password you set for ec2-user in step 6.
4. You will be prompted to enter the password again. Provide the password and proceed to the steps to configure the initial desktop.
5. If it prompts for “cloud user password” provide the root user password you set in step 7.
6. That it, you will get a GUI session as shown below. If you face any errors do let me know in the comment session.
If you have problems connecting via RDP, the connection is lost after 1-2 seconds, the solution is to install the epel repo. Follow these steps to install – https://www.cyberciti.biz/faq/installing-rhel-epel-repo-on-centos-redhat-7-x/ and run # yum update after that.