X
    Categories: AWSLinux

How to Access Ubuntu desktop on AWS EC2


You can install Ubuntu on AWS and access it using ssh port 22. However what if you want to access Ubuntu desktop on AWS EC2. This post will guide you how to access Ubuntu desktop on AWS EC2.


Pre-requisite for Access Ubuntu desktop on AWS EC2

  1. Running  Ubuntu AWS EC2 instance. In case dont know how to install Ubuntu on AWS please follow these steps.
  2. Make sure that you allowed port 5901 in the security group(Described in the link given in the step 1).

Steps:

1. Once you have installed the server on AWS . Login to server. (follow these steps in case you don’t know how to login to Ec2 instance) with default user name ubuntu and then do sudo su – to become root.

2. Installing softwares required for remote desktop in Ubuntu.

apt-get update
apt-get install ubuntu-desktop
apt-get install gnome-panel
apt-get install vnc4server

3.  Now use vncserver command for giving the password required to Access Ubuntu desktop on AWS EC2.

# vncserver

You will require a password to access your desktops.

Password:
Verify:
xauth:  file /root/.Xauthority does not exist


New 'ip-172-31-14-116:1 (root)' desktop is ip-172-31-14-116:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup

4. Edit the contents of “.vnc/xstartup” with below:

 cat .vnc/xstartup
#!/bin/sh

# Uncomment the following two lines for normal desktop:
 unset SESSION_MANAGER
gnome-session –session=gnome-classic &
gnome-panel&
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &

Save and quit the file using “:wq!” command in vi.

5. Now restart the vncserver process using below two commands.

# vncserver -kill :1
Killing Xvnc4 process ID 8550

# vncserver

New 'ip-172-31-14-116:1 (root)' desktop is ip-172-31-14-116:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/ip-172-31-14-116:1.log

6. Now to Access Ubuntu desktop on AWS EC2, you must download the tiger vnc java enabled viewer from this link.

7. Once downloaded click on the jar file named as “tightvnc-jviewer.jar”. and enter the “Public DNS” entry for Ubuntu ec2 instance in the dashboard under remote host box in Tiger VNC software.

 

Enter above Public DNS value in Tiger VNC as below:

8. Click on connect button and system will ask for password , Please use the same password given in the step 3 and click on “Ok” Button.

9. Upon successful authentication you can now Access Ubuntu desktop on AWS EC2.

So this how we Access Ubuntu desktop on AWS EC2.

View Comments (0)

Related Post