一直都在思考*NIX下面如何远程桌面,发现VNC实在是一个很好的东东,在*NIX平台上的性能表现远超过于Windows平台上面!
下面就以FreeBSD为例子来说明如何建立Remote Desktop:
1) FreeBSD + X-Window(xorg) + Gnome Desktop + VNCServer
2) Windows + RealVNC Viewer Free Edition
安装FreeBSD, xorg, Gnome不作过多叙述了,直入主题!
FreeBSD# cd /usr/ports/net/vnc FreeBSD# make FreeBSD# make install FreeBSD# make clean distclean |
完成后,可以用 which vncserver 查看路径为:/usr/local/bin/vncserver
在自己的home目录下面新建一个目录:
[xport@FreeBSD ~] $ mkdir .vnc [xport@FreeBSD ~] $ cd .vnc [xport@FreeBSD ~/.vnc] $ |
启动vncserver,第一次启动会为你的session设定密码:
[xport@FreeBSD ~/.vnc] $ vncserver You will require a password to access your desktops. Password:<--输入密码 Verify: <--确认密码 xauth: creating new authority file /home/xport/.Xauthority New 'X' desktop is xport.localdomain:1 Creating default startup script /home/xport/.vnc/xstartup <--这个文件很重要,接下来会修改它! Starting applications specified in /home/xport/.vnc/xstartup Log file is /home/dan/.vnc/xport.localdomain:1.log |
如果要关闭vncserver,用下面的方法:
[xport@FreeBSD ~/.vnc] $ vncserver -kill :1 [xport@FreeBSD ~/.vnc] $ ls -al total 16 -rw-r--r-- 1 xport users 10382 Oct 11 23:20 FreeBSD.localdomain:1.log -rw------- 1 xport users 8 Oct 11 23:09 passwd -rwxr-xr-x 1 xport users 184 Oct 11 23:11 xstartup |
接下来修改xstartup:
[xport@FreeBSD ~/.vnc] vi xstartup # 修改成下面的内容 #!/bin/sh [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic & # 下面的2行是vncserver第一次启动的时候产生的,为了使用Gnome,我把它们给 # 注释掉了 # xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & # twm & gnome-session & <--这个是我增加的,不要忘了后面的& |
好了,再次启动vncserver吧!
[xport@FreeBSD ~/.vnc] $ vncserver New 'FreeBSD.localdomain:1 (xport)' desktop is FreeBSD.localdomain:1 Starting applications specified in /home/xport/.vnc/xstartup Log file is /home/xport/.vnc/FreeBSD.localdomain:1.log [xport@FreeBSD ~/.vnc] $ |
好现在我们从Windows下面连接FreeBSD:

输入密码:

进入Gnome,我启动了Eclipse IDE:

哈哈,感觉这样运行比较爽!