首先重裝咯:ubuntu
sudo apt-get updateorm
sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminalserver
sudo apt-get install vnc4serverip
而後配置vnc密碼:ci
vncpasswdterminal
而後,此時建立一個端口服務:get
vncserver -geometry 1280x1024:1 // 1是端口號,要設置默認的能夠這樣設置:it
-----------------------------------------table
$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/xinitrcunset DBUS_SESSION_BUS_ADDRESSgnome-panel &gnmoe-settings-daemon &metacity &nautilus &gnome-terminal &重啓VNCserver就ok了。令注:vncserver :1 開啓服務vncserver -kill :1 關閉這個鏈接號