VNC远程到Digital Ocean Ubuntu 14.04

  1. ssh 到DO dorplet (ubuntu 14.04)
  2. apt-get install vnc4server
  3. apt-get install xfce4
  4. vncserver
    Password: xxxxxx
  5. edit /root/.vnc/xstartup to make it like this:#!/bin/sh

    # Uncomment the following two lines for normal desktop:
    unset SESSION_MANAGER
    #exec /etc/X11/xinit/xinitrc
    startxfce4 &
    #gnome-session –session=ubuntu-2d &

    [ -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 &

    ——————–

  6. vncserver -kill :1
  7. vncserver
  8. 下载 vncviewer http://www.realvnc.com/download/binary/1730/ 连接到ip:5901DOVNC20150706131614
  9. 想要vncserver自启动的话,创建文件 /etc/init.d/vncserver file:#!/bin/bash

    unset VNCSERVERARGS
    VNCSERVERS=””
    [ -f /etc/vncserver/vncservers.conf ] && . /etc/vncserver/vncservers.conf
    prog=$”VNC server”
    start() {
    . /lib/lsb/init-functions
    REQ_USER=$2
    echo -n $”Starting $prog: ”
    ulimit -S -c 0 >/dev/null 2>&1
    RETVAL=0
    for display in ${VNCSERVERS}
    do
    export USER=”${display##*:}”
    if test -z “${REQ_USER}” -o “${REQ_USER}” == ${USER} ; then
    echo -n “${display} ”
    unset BASH_ENV ENV
    DISP=”${display%%:*}”
    export VNCUSERARGS=”${VNCSERVERARGS[${DISP}]}”
    su ${USER} -c “cd ~${USER} && [ -f .vnc/passwd ] && vncserver :${DISP} ${VNCUSERARGS}”
    fi
    done
    }
    stop() {
    . /lib/lsb/init-functions
    REQ_USER=$2
    echo -n $”Shutting down VNCServer: ”
    for display in ${VNCSERVERS}
    do
    export USER=”${display##*:}”
    if test -z “${REQ_USER}” -o “${REQ_USER}” == ${USER} ; then
    echo -n “${display} ”
    unset BASH_ENV ENV
    export USER=”${display##*:}”
    su ${USER} -c “vncserver -kill :${display%%:*}” >/dev/null 2>&1
    fi
    done
    echo -e “\n”
    echo “VNCServer Stopped”
    }
    case “$1″ in
    start)
    start $@
    ;;
    stop)
    stop $@
    ;;
    restart|reload)
    stop $@
    sleep 3
    start $@
    ;;
    condrestart)
    if [ -f /var/lock/subsys/vncserver ]; then
    stop $@
    sleep 3
    start $@
    fi
    ;;
    status)
    status Xvnc
    ;;
    *)
    echo $”Usage: $0 {start|stop|restart|condrestart|status}”
    exit 1
    esac

  10. 修改自启动脚本为可执行 chmod +x /etc/init.d/vncserver

标签

发表评论

Comment List(2)