ubuntu 14.05 安装 vncserver

看了一位大神的教程,总结了下,大致如此

安装桌面环境xfce4

sudo apt-get update
sudo apt-get install gnome-core xfce4 xfce4-goodies firefox

安装桌面环境vncserver

sudo apt-get install tightvncserver

启动vncserver

vncserver

然后你设置下远程连接需要的密码
done!


Paste_Image.png

配置vncserver

人在江湖飘,哪能不备份,先复制一份配置文件再说

cp ~/.vnc/xstartup ~/.vnc/xstartup.bak

开始编辑配置文件xstartup

vim /root/.vnc/xstartup

将内容修改成

#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
 
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

干掉当前的vncserver

vncserver -kill :1

设置启动脚本

vi /etc/init.d/vncserver
#!/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
chmod +x /etc/init.d/vncserver

设置配置项

mkdir -p /etc/vncserver
vi /etc/vncserver/vncservers.conf
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768"

将它加入启动项

update-rc.d vncserver defaults 99

重启服务器,done!

ubuntu 14.05 安装 vncserver_第1张图片
Paste_Image.png

吐槽下,这界面有点土逼啊,而且桌面一个嘛意思,还笑得这么邪恶

你可能感兴趣的:(ubuntu 14.05 安装 vncserver)