aws ubuntu server安装vnc
ec2上
sudo su
apt install xfce4
apt install tightvncserver
shutdown -r now #(不确定需不需要重启)
重连后用ubuntu身份就行
vncserver :1 #(生成默认配置)
vncserver -kill :1
vim ~/.vnc/xstartup
写入下边的内容
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
unset DBUS_SESSION_BUS_ADDRESS
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
export XAUTHORITY=$HOME/.Xauthority
autocutsel -fork
startxfce4 &
xsetroot -solid grey
vncconfig -iconic &
# x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# x-window-manager &
其中,export XAUTHORITY=$HOME/.Xauthority
是为了能够在vnc session下运行snap版firefox。至少需要2g内存才不卡
再次启动 vncserver :1
在本地
apt install gvncviewer
ssh -L 5901:localhost:5901 远程ec2地址
在另一个cmd里:
gvncviewer :1