Setting up GUI on Amazon EC2 Ubuntu Server — Part II

This post is a part of a series (Part I)
In the previous article, I have demonstrated how to create Ubuntu Server on Amazon EC2 instance. In this article I will explain how to setup the GUI on Amazon EC2 Ubuntu Server using Windows Desktop.
Please follow these steps to setup the GUI:
Step-1: Install PuTTY from here
Step-2: Use PuTTYgen to create a private key compatible for PuTTY
1. Open PuTTYgen
2. Click Load and locate the private key downloaded from AWS

3. Click OK

4. Click Save private key to save the private key in the new format compatible with PuTTY

5. Click Yes

Step-3: Copy EC2 hostname by selecting your Instance and clicking onConnect


Step-4: Open PuTTY, Under “Session” set “Host Name” to the copied hostname
- Enter session name in the “Saved Sessions” text box (Optional)

Step-5: Under “Connection — Data” set “Auto-login username” to ubuntu

Step-6: Under “Connection — SSH — Auth” locate the private key generated using PuTTYgen by clicking on the Browse... button
- Under “Session” click on
Save(Optional)
Step-7: Now click onOpen button

Step-8: Click onYes

Bingo you are now connected to your Ubuntu server on AWS

Step-9: Now become superuser after executing the command
$ sudo -sStep-10: Type the following commands in sequence:
# sudo apt-get install ubuntu-desktopNote: If this command fails for some reason then run
$ sudo apt-get updateand then run above command again.
# sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
# sudo apt-get install vnc4serverStep-11: Type the command vncserver once and set the password
# vncserverStep-12: Kill vncserver by typing the command
# vncserver -kill :1Step-13: Type # vi .vnc/xstartup, Enter i to go into the insert mode and modify the file to the following
#!/bin/shexport XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid greyvncconfig -iconic &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
Step-14: Press ESC to escape the insert mode and then enter :wq to save and exit the file
Step-15: Type # vncserver again to start vncserver.
Step-16: Download and install TightVNC in your computer from the following link
Step-17: Now run TightVNC viewer
Step-18. Get your Amazon EC2 Ubuntu server public ip

Step-19: Now enter the Public IP and Port number in TightVNC as follows Public IP::Port and click onConnect

Step-20: Enter the password (password setup at Step-11) and click OK

Step-21: GUI on Ubuntu Server is ready
- You can click on save button to save the session so that you don’t have to enter these details over and over again (Optional)

Note: Execute the command
# vncservereverytime you restart your Amazon EC2 Ubuntu Server.
Thank you for reading this post, If you like it then please clap and share it on Facebook, LinkedIn or Twitter so that other people get benefits from it.
You can follow me on Github, LinkedIn or contact me at atinesh.s@gmail.com
Happy Coding!
