How To Install and Configure GUI for Amazon EC2 RHEL 7 Instance
In this tutorial, I have explained the easy steps to configure GUI for RedHat7 EC2 instance and connect to it using RDP clients.
Note: For RHEL 6 follow this tutorial. Setting up GUI on RHEL6
GUI for Amazon EC2 RHEL 7
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.
sudo yum -y update
2. Install the gnome GUI components using the following command.
sudo yum groupinstall -y "Server with GUI"
3. Issue the following commands to start the GUI during boot.
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.
Setting up XRDP
1. Add the xrdp repository to your instance using the following command.
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.
sudo yum install -y xrdp tigervnc-server
3. Setup SELINUX security using the following commands.
chcon --type=bin_t /usr/sbin/xrdp chcon --type=bin_t /usr/sbin/xrdp-sesman
4. Start and enable the xrdp service.
sudo systemctl start xrdp sudo systemctl enable xrdp
5. Enable RDP port on the instance using the following firewall commands.
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.
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.
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.