ubuntu 16.04 搭建tigervnc
2019-04-18 19:18 tangxiaosheng 阅读(6364) 评论(0) 编辑 收藏 举报主要参考 https://vitux.com/ubuntu-vnc-server/
apt install xfce4 xfce4-goodies -y
apt install -y tightvncserver
su - xxx
vncserver
vncserver -kill :1
cd /etc/systemd/system
vim vncserver@.service
文件内容是:
[Unit] Description=Remote desktop service (VNC) After=syslog.target network.target [Service] Type=forking User=xxx PIDFile=/home/xxx/.vnc/%H:%i.pid ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i ExecStop=/usr/bin/vncserver -kill :%i [Install] WantedBy=multi-user.target
改完以后,
sudo systemctl daemon-reload
sudo systemctl start vncserver@1.service
sudo systemctl enable vncserver@1.service
sudo systemctl status vncserver@1.service
域账户启动vncserver失败,转而求助于另一篇文章 https://websiteforstudents.com/install-and-configure-vnc-server-on-ubuntu-16-04-18-04/
vncserver@.service 这部分有差异:
[Service] Type=simple User=richard PAMName=login PIDFile=/home/%u/.vnc/%H%i.pid
但是域账户还是失败。于是改为非域账户。成功。
因为桌面是xfce4的,运行opencv提示出错,
于是安装gnome桌面,
apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
这样比较重型了,可以这样。
apt-get install --no-install-recommends ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal -y
改成gnome桌面,.vnc/xstartup这样配置:
#!/bin/sh xrdb $HOME/.Xresources xsetroot -solid grey export XKL_XMODMAP_DISABLE=1 unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS vncconfig -iconic & gnome-session --session=gnome-classic & [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & gnome-panel & gnome-settings-daemon &
这样还是没有解决问题。 于是又参考 https://stackoverflow.com/questions/37989517/gdkglext-warning-window-system-doesnt-support-opengl
#! /bin/bash # Make sure only root can run our script if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 exit 1 fi dpkg --purge tightvncserver dpkg -i xbitmaps_1.1.1-2_all.deb dpkg -i x11-apps_7.7+4_armhf.deb dpkg -i x11-session-utils_7.7+1_armhf.deb dpkg -i xbase-clients_1%3a7.7+7_all.deb dpkg -i vnc4server_4.1.1+X4.3.0-37.6_armhf.deb # Restart vnc running script in background systemctl restart vncboot.service
dpkg --purge tightvncserver,可能是这个起到作用了。最终解决了。