緊密的 VNC 伺服器、Ubutu 12.10 和 Unity 桌面

緊密的 VNC 伺服器、Ubutu 12.10 和 Unity 桌面

我已經完成了以下操作,但我在 VNC 檢視器中得到的只是一個空白的橙色螢幕,感謝任何幫助。

  1. apt-get -y install ubuntu-desktop tightvncserver

  2. adduser vnc && passwd vnc

  3. echo "vnc ALL=(ALL) ALL" >> /etc/sudoers

  4. sudo -u vnc vncpasswd

  5. nano ~/.vnc/xstartup並輸入以下內容:

    #!/bin/sh
    # Uncomment the following two lines for normal desktop:
    unset SESSION_MANAGER
    . /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 1280x1024+10+10 -ls -title "$VNCDESKTOP Desktop" &
    #x-window-manager &
    

    節省

  6. sudo nano /etc/init.d/vncserver,貼上以下內容,然後儲存:

    #!/bin/sh -e
    ### BEGIN INIT INFO
    # Provides:          vncserver
    # Required-Start:    networking
    # Default-Start:     3 4 5
    # Default-Stop:      0 6
    ### END INIT INFO
    
    PATH="$PATH:/usr/bin/"
    
    # The Username:Group that will run VNC
    export USER="vnc"
    #${RUNAS}
    
    # The display that VNC will use
    DISPLAY="1"
    
    # Color depth (between 8 and 32)
    DEPTH="16"
    
    # The Desktop geometry to use.
    #GEOMETRY="<WIDTH>x<HEIGHT>"
    #GEOMETRY="800x600"
    GEOMETRY="1024x768"
    #GEOMETRY="1280x1024"
    
    # The name that the VNC Desktop will have.
    NAME="my-vnc-server"
    
    OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
    
    . /lib/lsb/init-functions
    
    case "$1" in
    start)
    log_action_begin_msg "Starting vncserver for user '${USER}' on   localhost:${DISPLAY}"
    su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
    ;;
    
    stop)
    log_action_begin_msg "Stopping vncserver for user '${USER}' on localhost:${DISPLAY}"
    su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
    ;;
    
    restart)
    $0 stop
    $0 start
    ;;
    esac
    
    exit 0
    

    然後按 ctrl-x 儲存,Y 表示是,然後輸入接受檔名。

  7. chown -R vnc. /home/vnc/.vnc && chmod +x /home/vnc/.vnc/xstartup

  8. sed -i 's/allowed_users.*/allowed_users=anybody/g' /etc/X11/Xwrapper.config

  9. chmod +x /etc/init.d/vncserver && service vncserver start

  10. update-rc.d vncserver defaults

  11. 重啟。

  12. 最後,使用tightvnc檢視器客戶端進入那裡,瞧,空白的酷愛橘子螢幕。

答案1

您沒有為 xstartup 檔案設定 gui 會話,這就是為什麼當您嘗試透過 ubuntu 上的 vnc 遠端連線到桌面/伺服器時看到空白螢幕,如果您需要 gnome,請安裝這些軟體包

# apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

並使用這個 xstartup 文件

#!/bin/sh

export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &

答案2

據我所知,你無法通過 vnc 進入 unity。安裝不同的桌面環境就可以了。 xfce 的價值如下:

https://www.digitalocean.com/community/articles/how-to-setup-vnc-for-ubuntu-12

相關內容