首先重装咯:
sudo apt-get update
sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
sudo apt-get install vnc4server
然后配置vnc密码:
vncpasswd
然后,此时创建一个端口服务:
vncserver -geometry 1280x1024:1 // 1是端口号,要设置默认的可以这样设置:
-----------------------------------------
$which vncserver
/usr/bin/vncserver
$file /usr/bin/vncserver
/usr/bin/vncserver: symbolic link to /etc/alternatives/vncserver
$file /etc/alternatives/vncserver
/etc/alternatives/vncserver: symbolic link to /usr/bin/tightvncserver
$file /usr/bin/tightvncserver
/usr/bin/tightvncserver: a /usr/bin/perl script, ASCII text executable //找到啦,就是这个文件
$ grep "59" /usr/bin/vncserver -n //找到
vncPort = 5900 + $displayNumber;
if (!bind(S, pack('S n x12', $AF_INET, 5900 + $n))) {
这两个地方地5900,改成默认端口就可以
-------------------------------------------------
查看服务:$netstat -l
...........
然后就是使用vnc登录,但是可能出错,登录是全灰的,这时要修改~/.vnc/xstartup文件(没有的新增就可以):
#!/bin/sh
# Uncomment the following two lines for normal desktop:
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
unset DBUS_SESSION_BUS_ADDRESS
gnome-panel &
gnmoe-settings-daemon &
metacity &
nautilus &
gnome-terminal &
重启VNCserver就ok了。
令注:
vncserver :1 开启服务
vncserver -kill :1 关闭这个连接号