VagrantでVNCを接続する

$ sudo apt-get install vnc4server

で、vnc4serverをインスツール

コンフィグ書く。

$ sudo vi /etc/vnc.conf

vnc.confには解像度etc記入する。

$geometry = "1280x1024";
$depth = "24";

ここで一度立ち上げてconfigを作る。

パスワードも入力。

$ vnc4server

You will require a password to access your desktops.

Password:ubuntu
Verify:ubuntu

New ‘lucid32:1 (lucid32)’ desktop is lucid32:1

Creating default startup script /home/lucid32/.vnc/xstartup
Starting applications specified in /home/lucid32/.vnc/xstartup
Log file is /home/lucid32/.vnc/lucid32:1.log

一度止めて、生成されたファイルを書き換える

$ vncserver -kill :1
$ vi ~/.vnc/xstartup

x-window-managerをコメントアウト、exec gnome-sessionを追記。

これをやらないとUnityのツールバーとか出てこない。

#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
#x-window-manager &
exec gnome-session &

Vagrantfile

[htm]
config.vm.network :forwarded_port, guest: 5901, host: 15901
[/htm]
を追加する

ホストOSにVNCを追加する
ホストOSでVNCを起動
(Remmina)
localhost:15901
user:lucid32
password:ububtu
ゲストOSで
sudo apt-get install gnome-session

sudo shutdown -h now
で終了