Ubuntu desktop in the cloud accessible with VNC

To create a Ubuntu desktop on Amazon EC2 that can be accessed by VNC I did the following steps:

1. Create 64-bit Ubuntu server instance
2. Install ubuntu desktop:

sudo apt-get install ubuntu-desktop

3. Install x11vnc

sudo apt-get install x11vnc

4. Install xvfb

sudo apt-get install xvfb

5. Configure x11vnc

sudo nano /etc/init/x11vnc.conf

 start on login-session-start  
 script  
 /usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log  
 end script  

And you should also set a password for your vnc sessions:


sudo x11vnc -storepasswd /etc/x11vnc.pass

6. Configure X server to use xvfb:

(Add the xserver-command line)

sudo nano /etc/lightdm/lightdm.conf
 [SeatDefaults]  
 greeter-session=unity-greeter  
 user-session=ubuntu  
 xserver-command=/etc/X11/xinit/xserverrc  

(Replace the exec line)

sudo nano /etc/X11/xinit/xserverrc
 #!/bin/sh  
 #exec /usr/bin/X -nolisten tcp "$@"  
 exec Xvfb :0 -screen 0 1280x1024x24  

7. Reboot and then log in using ssh port-forwarding:

ssh -L5901:127.0.0.1:5900 -i mypem.pem ubuntu@someserver.compute.amazonaws.com

8. Connect with VNC using a vnc viewer to your local machine (127.0.0.1) port 5901


Comments

Popular posts from this blog

My VNC based development environment with Visual Studio Code running on Ubuntu

Intercepting and adjusting SQL generated by Eclipselink JPA

Exporting Kendo UI GRID to Excel with Java