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

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

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:

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

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

Latest Posts

Compare HP’s iLo & Dell’s iDRAC Server Management Tools

Most servers shipped from the major manufacturers today come with some type of out-of-band management tool or baseboard management controller (BMC). Two of the...

Get-MsolUser PowerShell Attributes & Properties

This article has been updated for 2020. Please note that WAAD was retired in 2018, but the cmdlets listed in this article are still...

Microsoft Azure PowerShell Scripts and Commands

Using PowerShell scripts and commands for quickly executing tasks in Windows operating systems offers a number of benefits over traditional scripting languages, such as...

Microsoft Hyper V Review

Microsoft Hyper-V: The Bottom line Microsoft Hyper-V lagged behind VMware's virtualization tool, one of the most popular tools in the space, when it was first...

Best Cloud Based Services & Companies

Any company that’s delayed introducing cloud-based software into their infrastructure needs to consider leveraging these new technologies to reap all the benefits cloud computing...

Related Stories