{"id":703,"date":"2015-02-17T11:28:43","date_gmt":"2015-02-17T11:28:43","guid":{"rendered":"https:\/\/blog.ngocha.biz\/?p=703"},"modified":"2015-02-17T11:28:43","modified_gmt":"2015-02-17T11:28:43","slug":"setup-gui-for-amazon-ec2-linux","status":"publish","type":"post","link":"https:\/\/blog.ngocha.biz\/?p=703","title":{"rendered":"How To Setup GUI For Amazon EC2 Linux Instance"},"content":{"rendered":"<p>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.<\/p>\n<h2 id=\"setting-up-gui-for-amazon-ec2-linux-rhel\">Setting up GUI for Amazon ec2 Linux (RHEL)<\/h2>\n<p><strong>Note: <\/strong>Please follow this tutorial for RHEL7.<strong>  <\/strong><a href=\"https:\/\/devopscube.com\/how-to-setup-gui-for-amazon-ec2-rhel-7-instance\/\"><strong>Configure GUI on RHEL 7<\/strong><\/a><\/p>\n<p>Follow the steps given below for setting up a desktop environment for ec2 RHEL6  instance.<\/p>\n<ol>\n<li>Login to the instance using any ssh client like putty and update the server.<\/li>\n<\/ol>\n<pre><code>sudo yum update -y<\/code><\/pre>\n<ol start=\"2\">\n<li>Install the Desktop environment.<\/li>\n<\/ol>\n<pre><code>sudo yum groupinstall -y \"Desktop\"<\/code><\/pre>\n<pre><code>[ec2-user@devopscube~]# sudo yum groupinstall -y \"Desktop\"\nxulrunner.x86_64 0:17.0.10-1.el6_4zenity.x86_64 0:2.28.0-1.el6\nComplete!<\/code><\/pre>\n<ol start=\"3\">\n<li>Install few dependencies using the following command.<\/li>\n<\/ol>\n<pre><code>sudo yum install -y pixman pixman-devel libXfont<\/code><\/pre>\n<pre><code>[ec2-user@devopscube~]$ sudo yum install -y pixman pixman-devel libXfont\nInstalled:pixman-devel.x86_64 0:0.32.4-4.el6\nComplete!<\/code><\/pre>\n<p><strong>Recommended:<\/strong> <a href=\"http:\/\/crunchadeal.com\/coupon\/93-off-coupon-learn-linux-in-5-days-and-level-up-your-career\/?ref=devopscube.com\">Learn Linux in 5 Days and Level Up Your Career Udemy Course<\/a><\/p>\n<ol start=\"4\">\n<li>Install tiger VNC server.<\/li>\n<\/ol>\n<pre><code>sudo yum -y install tigervnc-server<\/code><\/pre>\n<pre><code>[ec2-user@devopscube~]$ sudo yum -y install tigervnc-server \nxorg-x11-fonts-Type1\nInstalled: \ntigervnc-server-module.x86_64 0:1.1.0-16.el6\nComplete!\n[ec2-user@devopscube~]$<\/code><\/pre>\n<ol start=\"5\">\n<li>Set a password for the default user \u201cec2-user\u201d<\/li>\n<\/ol>\n<pre><code>sudo passwd ec2-user<\/code><\/pre>\n<pre><code>[ec2-user@devopscube~]$ sudo passwd ec2-user\nChanging password for user ec2-user.\nNew password:\nRetype new password:\npasswd: all authentication tokens updated successfully.\n[ec2-user@devopscube~]$<\/code><\/pre>\n<p>6. Set a password for VNC server by executing the following command.<\/p>\n<pre><code>vncpasswd<\/code><\/pre>\n<pre><code>[ec2-user@devopscube~]$ vncpasswd\nPassword:\nVerify:\n[ec2-user@devopscube~]$<\/code><\/pre>\n<p>7. Edit the sshd_config file and set the password authentication parameter to \u201cyes\u201d<\/p>\n<p>8. Restart the sshd service.<\/p>\n<pre><code>sudo service sshd restart<\/code><\/pre>\n<pre><code>[ec2-user@devopscube~]$ sudo service sshd restart\nStopping sshd:                                             [ OK ]\nStarting sshd:                                             [ OK ]\n[ec2-user@devopscube~]$<\/code><\/pre>\n<p>9.  Open the vncserver config file.<\/p>\n<pre><code>sudo vi \/etc\/sysconfig\/vncservers<\/code><\/pre>\n<p>10. Update the parameters of vncserver config file as shown below.<\/p>\n<pre><code>VNCSERVERS=\"1:ec2-user 2:user2\"\nVNCSERVERARGS[1]=\"-geometry 1024x768\"\nVNCSERVERARGS[2]=\"-geometry 1024x768\"<\/code><\/pre>\n<p><em><strong>Note:<\/strong> 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.<\/em><\/p>\n<p>11. Start the vnc server<\/p>\n<pre><code>sudo service vncserver start<\/code><\/pre>\n<pre><code>[ec2-user@devopscube~]$ sudo service vncserver \nstartStarting VNC server: 1:ec2-user \nxauth: creating new authority file \/home\/ec2-user\/.XauthorityNew 'ip-172-29-4-27:1 (ec2-user)'\n desktop is ip-172-29-4-27:1\nCreating default startup script \/home\/ec2-user\/.vnc\/xstartupStarting applications \nspecified in  \/home\/ec2-user\/.vnc\/xstartupLog \nfile is \/home\/ec2-user\/.vnc\/ip-172-29-4-27:1.log                                [ OK ]\n[ec2-user@devopscube~]$<\/code><\/pre>\n<p>12. Add&nbsp; vnc service to the system startup so that vnc server will automatically start after a system restart.<\/p>\n<pre><code>sudo chkconfig vncserver on<\/code><\/pre>\n<p>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.<\/p>\n<pre><code>iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT<\/code><\/pre>\n<p><em><strong>Note:<\/strong> Open TCP port 5901 in ec2 security group you have assigned to your instance.<\/em><\/p>\n<p>14. Now we have an instance with GUI configured. To access it you need a VNC&nbsp; client. Go to this&nbsp;<a href=\"http:\/\/www.realvnc.com\/download\/viewer\/?ref=devopscube.com\" rel=\"noopener\">link<\/a>&nbsp;to get a VNC viewer client. Install the software and open it.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<h3 id=\"setting-up-gui-for-ec2-ubuntu-instance\">Setting up GUI for ec2 Ubuntu Instance<\/h3>\n<p>Check <a href=\"http:\/\/www.comtechies.com\/2013\/02\/how-to-set-up-gui-on-amazon-ec2-ubuntu.html?ref=devopscube.com\">this article<\/a> for setting up GUI for ec2 Ubuntu instance.<\/p>\n<p>Let us know in the comment section if you face any errors.<\/p>\n<hr>\n<p><strong>Ngu\u1ed3n:<\/strong> <a href=\"https:\/\/devopscube.com\/setup-gui-for-amazon-ec2-linux\/\" target=\"_blank\" rel=\"noopener noreferrer\">How To Setup GUI For Amazon EC2 Linux Instance \u2014 DevOpsCube<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Source: https:\/\/devopscube.com\/setup-gui-for-amazon-ec2-linux\/<\/p>\n","protected":false},"author":1,"featured_media":704,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-703","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"_links":{"self":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/703","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=703"}],"version-history":[{"count":0,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/703\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/media\/704"}],"wp:attachment":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}