我正在尝试在无头的x86_64 ubuntu 20.10 上安装 vnc 。我不想要Xfce,所有教程都出于某种莫名其妙的原因告诉你安装 xfce。我不想安装这个软件包,因为我已经有了桌面管理器:Gnome(Ubuntu 上默认)。
据我所知,数字海洋指南似乎是最好的,除了他们的 xstartup 是针对 xfce 的。我尝试遵循并用 gnome-session 替换 xfce,但我只是得到一个灰屏并且无法与任何东西交互。
谁能帮助我解决这个问题或为我指出正确的方向。
谢谢!
编辑:这是我的 xstartup:
# Config requires following packages:
# gnome-panel nautilus gnome-terminal metacity
#
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
gnome-session &
gnome-panel &
metacity &
gnome-terminal &
Run Code Online (Sandbox Code Playgroud)
我使用以下命令通过 ssh 在远程计算机上运行 vncserver:
$ vncserver
New 'X' desktop is media-server:1
Starting applications specified in /home/kevin/.vnc/xstartup
Log file is /home/kevin/.vnc/media-server:1.log
Run Code Online (Sandbox Code Playgroud)
这是日志:
04/02/21 10:40:28 Xvnc version TightVNC-1.3.10
04/02/21 10:40:28 Copyright (C) 2000-2009 TightVNC Group
04/02/21 10:40:28 Copyright (C) 1999 AT&T Laboratories Cambridge
04/02/21 10:40:28 All Rights Reserved.
04/02/21 10:40:28 See http://www.tightvnc.com/ for information on TightVNC
04/02/21 10:40:28 Desktop name 'X' (media-server:1)
04/02/21 10:40:28 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
04/02/21 10:40:28 Listening for VNC connections on TCP port 5901
Font directory '/usr/share/fonts/X11/75dpi/' not found - ignoring
Font directory '/usr/share/fonts/X11/100dpi/' not found - ignoring
(gnome-panel:123980): gnome-panel-WARNING **: 10:40:30.098: Failed to acquire bus name!
metacity-Message: 10:40:30.227: could not find XKB extension.
(metacity:123981): metacity-WARNING **: 10:40:30.232: Failed to create compositor: Missing composite extension required for compositing
Xlib: extension "X-Resource" missing on display ":1".
Run Code Online (Sandbox Code Playgroud)
小智 6
这当然是可能的!没有什么神奇的,虚拟显示器、桌面管理器和 VNC 服务器是必须正确组合的三部分。
VNC 服务器设置包括 3 个主要步骤:
export DISPLAY=:1
Xvfb $DISPLAY -screen 0 1024x768x16
Run Code Online (Sandbox Code Playgroud)
$DISPLAY 并在那里渲染桌面的GUI 会话对于 XFCE 使用这个
sudo apt install xfce4 xfce4-goodies
Run Code Online (Sandbox Code Playgroud)
sudo apt install xfce4 xfce4-goodies
Run Code Online (Sandbox Code Playgroud)
对于默认的 gnome使用这个:
xfce4-session # start xfce4
Run Code Online (Sandbox Code Playgroud)
$DISPLAY 并提供对外部客户端的访问。不要以 sudo 身份运行!gnome-shell --replace # start ubuntu gnome
Run Code Online (Sandbox Code Playgroud)
密码设置
sudo apt install x11vnc
Run Code Online (Sandbox Code Playgroud)
x11vnc -storepasswd
Run Code Online (Sandbox Code Playgroud)
crontab -e添加到crontab 的最终脚本@reboot /path/to/script.sh
使用&语法在后台运行脚本
对于XFCE
x11vnc -display $DISPLAY -forever -loop -noxdamage -repeat -rfbauth /home/ubuntu/.vnc/passwd -rfbport 5900 -shared
Run Code Online (Sandbox Code Playgroud)
对于默认的 gnome
#!/bin/bash
source /home/ubuntu/.bashrc
export DISPLAY=:1
Xvfb $DISPLAY -screen 0 2048x1536x24 &
xfce4-session &
x11vnc -display $DISPLAY -forever -loop -noxdamage -repeat -rfbauth /home/ubuntu/.vnc/passwd -rfbport 5900 -shared &
Run Code Online (Sandbox Code Playgroud)