Posted onIntutorialViews: Word count in article: 2.7kReading time ≈2 mins.
In last post, I installed Ubuntu Desktop based on soft raid 1. Due to the need of remote maintenance for scientific software, I need a GUI environment. In this post, let’s learn how to do this.
VNC configuration (Not recommended)
When I want to deploy, VNC first comes into my mind, as I used it many times with my Raspberry Pi. However, it does not suit well with Ubuntu. Ubuntu default desktop(gnome) use Wayland as display server, which is not compatible with VNC. I have tried to use VNC to connect with gnome, it showed a grey screen and a black folk as mouse cursor. It cannot use at all. So we need to install new Desktop GUI.
1 2 3 4
sudo apt install xfce4 xfce4-goodies # install xfce4 as Desktop GUI sudo apt install tigervnc-standalone-server tigervnc-common # install tigervnc. Do not install tightvncserver, which is not compatible with Ubuntu in my experience. cp ~/.vnc/xstartup ~/.vnc/xstartup.bak vim ~/.vnc/xstartup
chmod +x xstartup vncserver # you need to set password if it is first time use
Then you can use VNC client to connect to your server. The default ip port is 5901 if your socket is :1, 5902 for :2 and so on.
Some useful commands:
1 2 3
vncserver -list # show all vncserver sockets vncserver -kill :1 # kill specific vncserver sockets vncserver -localhost no # allow connection from remote ip
XRDP configuration (Recommended)
1 2 3 4 5
sudo apt update #sudo apt install xfce4 xfce4-goodies -y If you want to use gnome as GUI , you don't need to install xfce4 sudo apt install xrdp -y sudo systemctl status xrdp # it should be active, if it is inactive, you need to run command: sudo systemctl start xrdp sudo vim ~/.xsession
1
gnome-session
1
sudo vim /etc/xrdp/startwm.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/bin/sh # xrdp X session start script (c) 2015, 2017, 2021 mirabilos # published under The MirOS Licence
# Rely on /etc/pam.d/xrdp-sesman using pam_env to load both # /etc/environment and /etc/default/locale to initialise the # locale and the user environment properly.
iftest -r /etc/profile; then . /etc/profile fi
# add the following two line to solve the black screen issue. The black screen is due to the gnome will prevent a new windows in default. unset DBUS_SESSION_BUS_ADDRESS unset XDG_RUNTIME_DIR
test -x /etc/X11/Xsession && exec /etc/X11/Xsession exec /bin/sh /etc/X11/Xsession
1
vim ~/.xsessionrc # to make the desktop environment the same as the local monitor shows