Usually, I used Fedora/CentOS as the development system. Recently, as I move into the machine learning world, I get my laptop setup with Ubuntu 14.04 LTS to utilize my GTX 860M for running ML algorithms. However, to set up vncserver properly on Ubuntu does not seems to be as easy as on Fedora/CentOS. In a lot of cases, you end up getting a blank desktop in your vnc-client with no menu and a basic GTK looking terminal.
I have searched online quite some while ago to find a good and easy way of setting up the vnc server and here comes the resolution. I cannot find the original post for the same method, so if you know, please give me a feedback there that I can credit the original writer.
1. Use x11vnc instead of tigervnc
To my knowledge, if you use tigervnc (command vncserver) as your vncserver, you are likely end up with a blank screen on your vnc-client. You need to add several parameters to your ~/.vnc/xstartup to start the old 2d unity menus and get it functional.
However, it seems to be pretty to setup with x11vnc without any change to xstartup script – and here is how:
Install x11vnc with command
$ apt-get install x11vnc
or you can download the newest x11vnc from sourceforge:
$ sudo apt-get install checkinstall
$ wget http://x11vnc.sourceforge.net/dev/x11vnc-0.9.14-dev.tar.gz
$ gzip -dc x11vnc-0.9.14-dev.tar.gz | tar -xvf -
$ cd x11vnc-0.9.14/
$ sudo checkinstall --pkgname=x11vnc --default --pkgversion="2:0.9.14-0.1" --backup=no --deldoc=yes
Create authentication password:
$ sudo /usr/local/bin/x11vnc --storepasswd /etc/x11vnc.pass
Start x11vnc with command:
$ sudo /usr/local/bin/x11vnc -auth /var/run/lightdm/root/:0 -display :0 -rfbauth /etc/x11vnc.pass -rfbport 5900 -noxrecord -noxfixes -noxdamage -forever -bg -o /var/log/x11vnc.log
You can figure out the meaning of all those parameters with
$ x11vnc -help
To start it automatically, create a file /etc/init/x11vnc.conf
Put following lines in the file
start on login-session-start
/usr/local/bin/x11vnc -auth /var/run/lightdm/root/:0 -display :0 -rfbauth /etc/x11vnc.pass -rfbport 5900 -noxrecord -noxfixes -noxdamage -forever -bg -o /var/log/x11vnc.log
2. Repeat Key Fix
The only draw back about x11vnc is the reaction to key repeating when you long pressing the same key on keyboard.
This issue only apply to VNC client in Windows.
And the problem is how VNC client react to key-long pressing in windows and linux
From the server side, you can actually configure it on the fly:
For Windows, if you want to enable key repeating, open a command line and type:
$ x11vnc -R repeat
For Linux, you need to disable repeat option by
$ x11vnc -R norepeat
And now, everything works fantastic!!