《VNC访问远端linux桌面详细步骤》《ubuntu7.10下安装vncsever》浅析ubuntu8.10使用xvncviewer实现远程gnome界面登录
1.安装软件
luther@gliethttp:~$ sudo apt-get install vnc4server xvnc4viewer
2.配置环境
luther@gliethttp:~$ sudo su
root@gliethttp:/home/luther# cd /root/
root@gliethttp:~# vncserver :1 // 启动vncserver
You will require a password to access your desktops.
Password: // 输入登录vncserver的密码
Verify:
New 'gliethttp:1 (root)' desktop is gliethttp:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/gliethttp:1.log
root@gliethttp:~# cd .vnc/
root@gliethttp:~/.vnc# ls
gliethttp:1.log gliethttp:1.pid passwd xstartup
root@gliethttp:~/.vnc# vim xstartup
删除xstartup中的所有内容,添加如下内容
#!/bin/sh
# 用来启动scim输入法[luther.gliethttp]
/usr/bin/scim -d
XMODIFIERS="@im=SCIM"
export XMODIFIERS
export GTK_IM_MODULE=scim
# 用来设置xvncviewer登录时的语言环境,必须设置,否则utf8汉字乱码.
export LC_ALL=en_US.UTF-8
gnome-session &
root@gliethttp:~/.vnc# vncserver -kill :1 // 杀死刚才的vncserver
Killing Xvnc process ID 7764
root@gliethttp:~/.vnc# vncserver :1 // 重新启动一次,使上面对xstartup修改生效.
New 'gliethttp:1 (root)' desktop is gliethttp:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/gliethttp:1.log
root@gliethttp:~/.vnc# exit // 退出root用户
exit
3.运行xvncviewer或者windows上的VNC Viewer
3.1 windows上的VNC Viewer输入信息如下:
Server: 192.168.23.23:1
Encryption: Let Server Choose(Default)
这样单击Connect,提示输入密码,成功输入之后就可以登录ubuntu的gnome界面了.
3.2 ubuntu上运行xvncviewer登录server,必须使用root权限运行xvncviewer
luther@gliethttp:~$ sudo xvncviewer 192.168.23.23:1 -passwd /root/.vnc/passwd
VNC Viewer Free Edition 4.1.1 for X - built Apr 16 2008 13:02:40
Copyright (C) 2002-2005 RealVNC Ltd.
See for information on VNC.
Tue May 26 12:45:57 2009
CConn: connected to host 192.168.23.23 port 5901
CConnection: Server supports RFB protocol version 3.8
CConnection: Using RFB protocol version 3.8
TXImage: Using default colormap and visual, TrueColor, depth 24.
CConn: Using pixel format depth 6 (8bpp) rgb222
CConn: Using ZRLE encoding
CConn: Throughput 20000 kbit/s - changing to hextile encoding
CConn: Throughput 20000 kbit/s - changing to full colour
CConn: Using pixel format depth 24 (32bpp) little-endian rgb888
CConn: Using hextile encoding
Tue May 26 12:45:58 2009
CConn: Throughput 20000 kbit/s - changing to raw encoding
CConn: Using raw encoding
4. 让ubuntu起机之后自动运行vncserver
luther@gliethttp:~$ sudo vim /etc/rc.local
# 追加如下内容到rc.local
sudo vncserver :1
5. 写一行脚本执行vncserver,使登录更简洁
luther@gliethttp:~$ sudo vim /usr/bin/23
# 追加如下内容到23
sudo xvncviewer 192.168.23.23:1 -passwd /root/.vnc/passwd
luther@gliethttp:~$ sudo chmod +x /usr/bin/23
luther@gliethttp:~$ 23 // 这样就可以直接登录vncserver了[luther.gliethttp]