http://cisight.com/how-to-setup-vnc-server-remote-desktop-in-ubuntu-11-10-oneiric/
Install VNC server in Ubuntu 11.10 Oneiric for remote-desktop is very easy. Here are the steps to install :
sudo apt-get install x11vnc
sudo x11vnc -storepasswd yourpasswordhere /etc/x11vnc.pass
sudo chmod 744 /etc/x11vnc.pass
如果没有安装Ubuntu桌面:
sudo apt-get install x-window-system-core
sudo apt-get install ubuntu-desktop
然后安装管理器lightdm:
#sudo apt-get install lightdm
Now you should edit your lightdm :
sudo vim /etc/lightdm/lightdm.conf
#加入下面的一行,重启服务器
greeter-setup-script=/usr/bin/x11vnc -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /tmp/x11vnc.log
#如果这个文件没有的话,说明lightdm没有安装或者没有启动执行lightdm来启动
#如果连接vnc的时候Failed to load session "ubuntu"的解决办法
'''
sudo apt-get update
sudo apt-get install ubuntu-desktop
sudo apt-get -f install
sudo dpkg-reconfigure ubuntu-desktop
sudo reboot
sudo apt-get install gnome-session
sudo apt-get install lightdm
sudo apt-get install unity-greeter
sudo dpkg-reconfigure lightdm
'''
To run manually :
sudo x11vnc -rfbauth /etc/x11vnc.pass -o /var/log/x11vnc.log -forever -bg -rfbport 5900 -nomodtweak
or
sudo x11vnc -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes
-noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o
/tmp/x11vnc.log
Happy remote desktop!