After installing the CentOS in Amazon AWS getting the GUI

General support questions
Post Reply
expmrb
Posts: 26
Joined: 2019/02/19 14:31:35

After installing the CentOS in Amazon AWS getting the GUI

Post by expmrb » 2019/02/21 09:19:54

After installing the CentOS in Amazon AWS or any other similar server.

With the ip address provided I will be able to login to my root through putty as I am using Windows, right?!!

So, my query here is how can I get the GUI of CentOS and connect it through the Remote Desktop Connection.

Anju Singh
Posts: 14
Joined: 2018/12/06 03:48:59

Re: After installing the CentOS in Amazon AWS getting the GUI

Post by Anju Singh » 2019/03/06 23:52:10

Setting up GUI for Amazon ec2 Linux (RHEL)
1. Login to the instance using any ssh client like putty and update the server.
sudo yum update -y

2. Install the Desktop environment.
sudo yum groupinstall -y "Desktop"

[ec2-user@devopscube~]# sudo yum groupinstall -y "Desktop"
xulrunner.x86_64 :17.0.10-1.el6_4zenity.x86_64 :2.28.0-1.el6
Complete!

3. Install few dependencies using the following command.
sudo yum install -y pixman pixman-devel libXfont

[ec2-user@devopscube~]$ sudo yum install -y pixman pixman-devel libXfont
Installed:pixman-devel.x86_64 :0.32.4-4.el6
Complete!

4. Install tiger VNC server.
sudo yum -y install tigervnc-server

[ec2-user@devopscube~]$ sudo yum -y install tigervnc-server
xorg-x11-fonts-Type1
Installed:
tigervnc-server-module.x86_64 :1.1.0-16.el6
Complete!
[ec2-user@devopscube~]$

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

[ec2-user@devopscube~]$ sudo passwd ec2-user
Changing password for user ec2-user.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[ec2-user@devopscube~]$

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

[ec2-user@devopscube~]$ vncpasswd
Password:
Verify:
[ec2-user@devopscube~]$

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

8. Restart the sshd service.
sudo service sshd restart

[ec2-user@devopscube~]$ sudo service sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
[ec2-user@devopscube~]$

9. Open the vncserver config file.
sudo vi /etc/sysconfig/vncservers

10. Update the parameters of vncserver config file as shown below.
VNCSERVERS="1:ec2-user 2:user2"
VNCSERVERARGS[1]="-geometry 1024x768"
VNCSERVERARGS[2]="-geometry 1024x768"
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

sudo service vncserver start
[ec2-user@devopscube~]$ sudo service vncserver
startStarting VNC server: 1:ec2-user
xauth: creating new authority file /home/ec2-user/.XauthorityNew 'ip-172-29-4-27:1 (ec2-user)'
desktop is ip-172-29-4-27:1
Creating default startup script /home/ec2-user/.vnc/xstartupStarting applications
specified in /home/ec2-user/.vnc/xstartupLog
file is /home/ec2-user/.vnc/ip-172-29-4-27:1.log [ OK ]
[ec2-user@devopscube~]$

12. Add vnc service to the system startup so that vnc server will automatically start after a system restart.
READ How to Setup and Push Server/Application Logs to AWS Cloudwatch
sudo chkconfig vncserver on

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.

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
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.

billwest
Posts: 154
Joined: 2006/11/19 10:50:31
Location: Perth, Western Australia

Re: After installing the CentOS in Amazon AWS getting the GUI

Post by billwest » 2019/03/07 00:05:28

Step 3 onwards: Install X2Go ?

Post Reply