Set up a Lightweight Desktop Environment on the Raspberry Pi with XFCE4

by | Nov 17, 2018 | Technology

Updated November 15th, 2019

The Raspberry Pi is an amazing little device, but when it comes to running a desktop environment it can be a little sluggish. Here I will show you how to set up a responsive desktop environment, complete with web-browser, network access, file sharing and incoming remote desktop capabilities.

Lets install Raspian Lite

Lets grab the latest release version of Raspian Lite from here.

Once downloaded, write the image to your SD card. If your new to writing images, there is a great cross-platform program called Etcher you can use to write to the SD card. It can be found here.

Once your have written to the SD card, lets insert and start our Raspberry Pi.

Configure Raspian Lite

On first boot, we will need to do some initial configuration on the Raspberry Pi. First we need to log into the system with the following.

User: pi
Pass: raspberry

This will log us in with the default user/pass. Now at the command prompt, enter the following.

[sourcecode language=”shell”]sudo raspi-config[/sourcecode]

Change your default password. (You may want to set your keyboard layout first under localization options)
Configure your network options.
Configure your Localization settings.
Under Interfacing Options, set SSH to be active.

Once complete, select Finish to reboot the system.

Once restarted, lets now login to our Raspberry Pi again using SSH or the console again with

User: pi
Pass: (new password)

Now lets see if there are any updates for Raspian using the following commands.

[sourcecode language=”shell”]sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
sudo reboot[/sourcecode]

Lets Install our Desktop Environment

Once restarted, lets login back in and install the packages needed to get our desktop up and running.

[sourcecode language=”shell”]sudo apt install xfce4 #installs the XFCE4 desktop environment
sudo apt install xfce4-goodies #install additional standard Xfce4 applications
sudo apt install gvfs-fuse gvfs-backends -y #Allows our desktop to network with remote file systems
sudo apt install firefox-esr #Installs Firefox web-browser (Extended Support Release)
sudo apt install chromium #Alternatively you can install Chromium
sudo apt install xrdp #Installs remote desktop server (Allow incoming desktop connections)
sudo apt install samba #Allows us to create file shares[/sourcecode]

Lets configure xRDP to allow connections

With the initial installation of xRDP, it is not configured to allow incoming connections. We can fix that by making the following changes.

[sourcecode language=”shell”]sudo nano /etc/X11/Xwrapper.config[/sourcecode]

Change the allowed_users=console to be allowed_users=anybody

Press CTRL + x, y to save, and overwrite the file.

Now lets set our Raspberry Pi to boot into the desktop

Now we are going to set our Raspberry Pi to boot directly into the desktop. We can do this by going into our Raspberry Pi Configuration.

[sourcecode language=”shell”]sudo raspi-config[/sourcecode]

Select Boot Options, Desktop/CLI, and select Desktop or Desktop Autologin.

Select Finish, and Yes to Reboot.

All finished!

Now when you have rebooted, you should go directly into your desktop. If you selected the default panel layout, at the bottom center, you should be able to launch Firefox or Chromium and use the file manager to browse your Raspberry Pi and network. A simple setup, but a good start for you to customize and configure as you like. Now you can add software and customize as you like!

You will also be able to connect to your Raspberry Pi desktop using Remote Desktop on Windows, or with Remina on Linux using your Raspberry Pi’s IP address and login information.

If you found this guide helpful please leave me some encouragement below! If your really happy, you can always gift me a coffee, I can never say no to coffee!

I have also by request added a bitcoin donation address. If you want to show your appreciation I would be grateful, but under no means do you need to feel obligated. This is a fun hobby for me. 🙂

BTC: 1GzagpXcAkELhU5emJFMLZpp7J5ayfcNQF

And for those that have, thank you for enabling my addiction! You all know who you are!