How To Setup GUI For Amazon EC2 Linux Instance

Amazon ec2 Linux instances do not come with a GUI. By default, you need terminal access for all application configuration. Most of the developers/sysadmins working with Linux would prefer  the command line over Graphical User Interface. But developers who are new to Linux would require a GUI for installing and managing the applications. In this post, we will teach you how to configure a graphical user interface (GUI) for an Amazon ec2 Linux instance.

Setting up GUI for Amazon ec2 Linux (RHEL)

Note: Please follow this tutorial for RHEL7.  Configure GUI on RHEL 7 

Follow the steps given below for setting up a desktop environment for ec2 RHEL6  instance.

1. Login to the instance using any ssh client like putty and update the server.

2. Install the Desktop environment.

3. Install few dependencies using the following command.

Recommended: Learn Linux in 5 Days and Level Up Your Career Udemy Course

4. Install tiger VNC server.

5. Set a password for the default user “ec2-user”

READ  List of Best Cloud Computing Certifications

6. Set a password for VNC server by executing the following command.

7. Edit the sshd_config file and set the password authentication parameter to “yes”

8. Restart the sshd service.

9.  Open the vncserver config file.

10. Update the parameters of vncserver config file as shown below.

Note: You can add more than one user to access vnc server. In the above snippet, we have user2 apart from ec2-user and subsequently make entry for screen resolution for the particular user, as shown above.

11. Start the vnc server

12. Add  vnc service to the system startup so that vnc server will automatically start after a system restart.

READ  Linux VI Editor Shortcuts, Tips and Productivity Hacks For Beginners

13. VNC server uses ports starting from 5901. For the second user, the port will be 5902 and so on. In our case, we have only one user (ec2-user). So we will be connecting to the instance on port 5901. Add a firewall rule to your instance to open 5901 using the following command.

Note: Open TCP port 5901 in ec2 security group you have assigned to your instance.

14. Now we have an instance with GUI configured. To access it you need a VNC  client. Go to this link to get a VNC viewer client. Install the software and open it.

15. Enter the public IP of you instance followed by the port number 5901 (assuming you the first vnc server user) and click connect. When asked for a password, supply the password you created for vnc server in step 6.

16. Now you will get the access to the GUI. If it asks for ec2-user password, supply the password you created in step 5.

Setting up GUI for ec2 Ubuntu Instance

Check this article for setting up GUI for ec2 Ubuntu instance.

Let us know in the comment section if you face any errors.

Free DevOps Resources

Get DevOps news, tutorials and resources in your inbox. A perfect way If you want to get started with devops. Like you, we dont like spam.