dcsimg
Read more on "Server Software Spotlight" »

Setting Up VNC on Ubuntu in Amazon EC2 - Page 3 Page 3

By Eric Geier (Send Email)
Posted May 1, 2012


Configuring Ubuntu with the Desktop Environment and VNC Server

Now you can install the desktop packages and remote desktop (VNC) server by entering (or copying and pasting) the following commands one at a time:

sudo apt-get update
sudo apt-get install ubuntu-desktop
sudo apt-get install vnc4server

 

Now, to configure the VNC server enter vncserver, which will then prompt you to create a password. Once created, enter vncserver -kill :1 to stop the server.

Next, configure the VNC xstartup file so you'll see the desktop when connecting via VNC. Enter vim .vnc/xstartup.

Then hit the Insert key, scroll around the text file with the keyboard arrows, and delete the pound (#) sign from the beginning of the two lines under the line that says "Uncomment the following two lines for normal desktop." And on the second line add "sh" so the line reads exec sh /etc/X11/xinit/xinitrc. When you're done, hit Ctrl + C on the keyboard, type :wq and hit Enter.

Now you can start the VNC server again by entering vncserver. And remember, you must enter this again at every reboot if you want VNC access, or consider configuring it to automatically run at startup.

Connecting to the Ubuntu Instance via VNC

Now that you have Ubuntu set up, you need to install a VNC client (like TightVNC) on your local machine, and when connecting enter the following address:

127.0.0.1:9000

When connecting via that address you must first connect to the server via SSH (like with PuTTY) and then connect with the VNC client.

If you prefer to connect directly to your Ubuntu instance via VNC rather than having to SSH into it first, you can use the Public DNS address (from the AWS Instances page of your instance) followed by a colon and the number one, such as ec2-184-169-226-14.us-west-1.compute.amazonaws.com:1.

Or you could even create an elastic IP and associate it with your Ubuntu instance, which you could then use (also with the colon and 1) to connect via VNC. But remember when connecting directly via VNC, it isn't as secure and you must open port 5901 up on the firewall via the Security Groups page.

Eric Geier is a freelance tech writer. He's also the founder of NoWiresSecurity, which provides a cloud-based Wi-Fi security service for businesses, and On Spot Techs, which provides on-site computer services.

Follow ServerWatch on Twitter

Page 3 of 3

Read more on "Server Software Spotlight" »

Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.