How To Install and Configure GUI for Amazon EC2 RHEL 7 & RHEL 8 Instance

amazon ec2 rhel 7 gui

In this tutorial, I have explained the easy steps to configure GUI for the RedHat 7 & 8 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 & RHEL 8

There are three sections involved in the whole setup. Follow all the three sections explained below to successfully configure the GUI.

Note: This tutorial is tested on both RHEL 7 and RHEL 8 ec2 instances.

Prerequisites

  1. RHEL 7 or 8 ec2 instance with minimum instance type of t2.medium. The GUI won’t load on smaller instance types.
  2. ec2 instance security group should have an inbound connection to 3389 port.

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.

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.

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 a windows RDP client.

If you are using MAC, you can use the Microsoft Remote Desktop app to connect.

Connecting the Instance Using RDP

Note: Make sure you have added the inbound RDP port (3389) 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’s it, you will get a GUI session as shown below. If you face any errors do let me know in the comment session.

amazon ec2 rhel 7 gui
5 Shares:
66 comments
  1. Is this even possible under the free tier t2 micro or t3 micro? Followed all the instructions but when I try to connect using Windows RDP it just fails to connect to the public IP.

    1. Hi Carl,

      We tested it with RHEL 8..Looks like you need a minimum t.medium machine for it to work properly. Also, check your firewall (security group) for the inbound 3389 port.

  2. Awesome, thanks many times over. Having a real ball ache with IBM WAS & HTTPD, and having the gui on an aws instance just allievates 50% of the pain.

  3. Awesome!! Very easy, simple to follow. I did and I got disconnected after 1-2sec. I commented the file as you said and everything is working. Thank you very much!!

  4. Hi ,
    I follow all steps but when i try to connect with rdp client the screen come dark, blue screen

  5. When I am doing double click or try to copy some text using GUI, my remote connection is going disconnecting..

    Any Suggestion please..

  6. For those who are getting disconnected after 1 – 2 secs, you need to edit the file /etc/xrdp/xrdp.ini and comment out the line containing “channel_code = 1”.

    Hope this helps

  7. Hi,
    Even after installing epel repo, connecting via RDP, the connection is lost after 1-2 seconds.
    Please advise me on how to fix this.
    Thanks
    Geeta

  8. I’m thinking this isn’t going to work on a t2.micro. In the Microsoft RDP, I’ve reduced the number of colors and the size of the display. Now instead of a black screen, I get an xrdp logo on the screen during login. Once I supply login credentials, the console log says it’s logging in, but then it hangs on a blank screen

  9. any updates on the connection termination after few seconds ? I have no issues connecting to the instance with Microsoft RDP but the connection terminates immediately.

  10. Same as many others here. After connecting via RDP the connection is lost after 1-2 seconds. I can’t see the solution here?

    1. Raj,

      Try and follow the instructions at https://aws.amazon.com/premiumsupport/knowledge-center/connect-to-rhel-73-windows/

      I am not sure enabling EPEL or changing the value for colour at RDP solved the problem but it worked for me. Before doing this, I had the same problem.

      On Windows, open the Remote Desktop Connection client (mstsc.exe) and modify the default value for Colors located under the Display tab. Change this value from “Highest Quality (32 bit)” to a different value such as “High Color (16 bit)”

  11. I succesfully completed above steps and i connected to RDP …after entering credentials it shows desktop for 2 seconds and i got lost my connection. what might be the problem?

  12. I am using RedHat 7 on aws and I followed all the steps from this tutorial. Everything went smoothly until I connected to instance, it just connects and after 1-2 seconds I lose connection, window is closed. Can anyone help on this?

  13. This works, but why is anything to do with Java display nothing. The window pop up in rdp , but display nothing. while in mobaxterm it display.

    Eg trying to display java console in mobaxterm works, but via rdp , it pop up , but display nothing.

  14. I am getting following error in windows RDP session:

    Remote Desktop cant connect to the remote computer for one of these reasons
    1) REmote access to the server is not enabled
    2) The remote computer is turned off
    3) the remte computer is not available on the network

    Make sure the remote computer is turned on and connected to the network & the remote access is enabled.

    Need your guidance.

  15. Hi, Haris and all,

    I had the same problem and I was able to resolve it by doing the following:

    1: install epel-release
    2: yum update

    After that, the issue was resolved.

  16. I am using RedHat 7 on aws and I followed all the steps from this tutorial. Everything went smoothly until I connected to instance, it just connects and after 1-2 seconds I lose connection, window is closed. I didn’t saw any errors anywhere, it is pretty strange.
    Maybe there is some limitation for RAM or CPU to be able to run GUI on redhat is causing this issue?
    Any advice?

    Thanks

  17. @Simon @Tonny if using CentOs change the password of the “centos” user instead of the “ec2-user”
    sudo passwd centos
    and use that password

  18. Hi, I have the same problem: despite setting the root password as mentioned in step 7 I still cannot authenticate when the popup requests a “Cloud User” password.
    Could you advise on the matter please?
    Thanks a lot!

  19. I went through these great steps which worked beautifully, I RDP successfully but only issue is that the Authentication Required for cloud user keeps popping up even after entering the password correctly.

  20. I did all the steps. But then when i try to use RDP on my windows machine. It states that it can’t connect. Any ideas where to look for?

  21. I have followed all steps to configure GUI on Amazon EC2 instance of type RHEL7.
    I am able to enable 3389 port too.
    When I did RDP from Windows machine, it connects to remote screen but BLACK screen appears and then I am stuck. There are no errors reported.
    Please suggest.

    1. I had the same issue. The screen was black. I waited a few minutes it came alive. Now it is hanging. Any suggestions. I am hard wired in with a 50MB download and 10MG upload speed.

  22. I’m stuck on 7 root password for cloud user. I already changed the root password but it is not accepting.

  23. Hi,
    I’m using macos. What remote client should I be using? I tried macOs RDP and VNC viewer client but it doesn’t work

  24. I’m stuck on this part. I already changed the root password but it won’t accept it.

    5. If it prompts for “cloud user password” provide the root user password you set in step 7.

  25. This is incredible! I searched online for a week to find out how to do this. You guys won’t like me much cuz I’m a Windows guy and HATE Linix! (:-) . Not really, but I’m horrible at it……never learned it. But I’m a big AWS fan and certified, so now i have to learn some Linux. Anyway, this tutorial was absolutely perfect! Worked first time! Thanks DEVOPSCUBE. Great site here! Now at least i feel a little more at home with this GUI! 🙂

  26. Everything went well and i could connect with using the credentials. But there started all surprises. what i can see is a black screen on remmina on ubuntu

    1. Hello, thanks for the great post.
      I’m almost there, I’m on RHEL 7, I am passing authentication and then all I get is a black screen, did someone manage to fix it?

      Thanks

    2. what did you do after u saw a black screen ? because i am facing the same issue for rad hat linux instance

  27. Works great. Initial login said “Authentication required to set Network Proxy” as you mentioned in the article. I put in the root password and it took it, but then it went right back to the “Authentication required to set Network Proxy” screen and asked for it again. It asked me about 20 times before it finally went away. Afte that I was on the desktop and all was good.
    FYI , if any one else runs into this , it easier to just hit CTRL-ALT-ESC 20 times, instead of typing in the root password. Eventually the Authentication screen will go away and you will get to the desktop.

  28. I had the same problem as Jennifer Shawster. The solution was to open this file:

    /etc/xrdp/startwm.sh

    And add this at the top:

    #!/bin/sh
    gnome-session
    exit 0

    Probably everything after the exit 0 can be deleted.

  29. Stuck on “sending login information to session manager, please wait…”, just hangs there. Not sure what else to do to fix this

      1. I was having the same issue but i get rid by upgrading the Instance type from T2 micro to T2 medium. Hope, it may also work for you.

  30. Hi! Thanks for putting up this resource 🙂

    connecting to seaman ip 127.0.0.1 port 3350
    sesame connect ok
    sending login info to session manager, please wait….
    xrdp_mm_process_login_response:login successful for display
    started connecting
    connecting to 127.0.0.1 5910
    error – problem connecting

    any idea on how to deal with this error?

  31. Hi there!

    I have followed all steps exactly on a freshly installed EC2 image of RHEL 7.2. When I try to connect with MobaXtem I receive the following error.

    The client could not connect to the remote computer.
    Remote conenctions might not be enabled or the computer might be to busy to accept new connections.
    It is also possible network problems are preventing you from our connection. Please try again later.
    If the problem persists please contact your Admin.

    Any Ideas?

  32. Hi
    I have tried till prompted to enter the password again
    its not allowing me to log in asking again cloud user password

      1. Hi katrine,

        The issue will get fixed if you set the root password and use it when asked for cloud user password. I have tested it and updated the article. Thanks for the comment!!

  33. Everything seems to have gone smoothly up until I try to access the box. I’m using TigerVNC viewer on Windows, and it times out and fails to connect. Should I be appending the port to the public IP of the box? x.x.x.x:3394? Would another RDP program be better? I’ve also opened the port in the Amazon AWS security profile, so I don’t think that’s the issue.

    Thanks for your guide!

    Edit: The issue was apparently TigerVNC. Windows RDP is working fine.

  34. I get to the last step of entering the password a second time and it won’t let me log in.

    I found the answer:
    rm -rf /tmp/.X*
    then reboot the server
    works fine now.

  35. I tried the first steps and got:

    [[email protected] ec2-user]# yum -y update

    Loaded plugins: priorities, update-motd, upgrade-helper

    23 packages excluded due to repository priority protections

    No packages marked for update

    [[email protected] ec2-user]# yum groupinstall -y “Server with GUI”

    Loaded plugins: priorities, update-motd, upgrade-helper

    There is no installed groups file.

    Maybe run: yum groups mark convert (see man yum)

    23 packages excluded due to repository priority protections

    Warning: group Server with GUI does not exist.

    Maybe run: yum groups mark install (see man yum)

    Error: No packages in any requested group available to install or update

    [[email protected] ec2-user]#

Leave a Reply

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

You May Also Like