Use your Raspberry Pi as an headless server that has a GUI you can control using VNC.
Pick what desktop environment to use, if you want a barebones desktop just to control the GUI on the Raspberry Pi, use an window manager like Openbox and Fluxbox.
Or if you want the full desktop experience on your Raspberry Pi, use a full desktop environment like LXQT.
- Install a window manager or desktop environment.
sudo apt install openbox
for openbox orsudo apt install lxqt
for LXQT or any other WM/DE likefluxbox
andxfce4
. - Install TigerVNC Server.
sudo apt install tigervnc-standalone-server
- Create a new VNC configuration file.
nano ~/.vnc/tigervnc.conf
- Add the following text inside tigervnc.conf to choose your own screen resolution and to enable access outside localhost.
|
|
- Start TigerVNC Server. This will prompt a new password if password has not yet set.
vncserver
- Now you can connect to your Raspberry Pi using VNC on the IP address of your Raspberry Pi.
As the default settings on TigerVNC prevents clients outside the localhost of Raspberry Pi from connecting to the server, the setting $localhost = "no";
should be included inside tigervnc.conf.
If you have installed multiple window/desktop managers, you can select what to use by sudo update-alternatives --config x-session-manager
.
- If you want to install LXQT without all the recommended packages just append
--no-install-recommends
. - Example:
sudo apt install lxqt --no-install-recommends
Tested on Raspberry Pi 4 Model B.
If you are using Ubuntu 20.04, there is a bug that kills TigerVNC just after connect, to fix this just append
LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1
if you are using 64-bit Ubuntu before the vncserver command.
Example:LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1 vncserver
For 32-bit Ubuntu useLD_PRELOAD=/lib/arm-linux-gnueabihf/libgcc_s.so.1
.