Help

Installing the XFCE Desktop Environment on Ubuntu

To make managing your server more convenient, you can install a desktop environment. This lets you perform various tasks, such as navigating directories and working with files, through a familiar graphical desktop interface rather than only from the command line. Below, we will go through installing the XFCE desktop environment, which is lightweight and easy on your server's resources.

In this guide, we will install XFCE with Russian language support and configure the keyboard applet to use the Cyrillic layout on the server.

This guide applies to servers running Ubuntu 16.04 and later.

Installing XFCE

1. First, connect to the server via SSH.

2. Then run the following commands:

Install the required packages, including the desktop environment (xfce4), the login manager (xdm), the keyboard applet (xfce4-xkb-plugin), and the Russian localization.

apt update && apt install xfce4 xdm xfce4-xkb-plugin language-pack-ru -y

Allow all users (anybody) to start the X server, and specify that xfce4-session should be used as the session manager when logging in to graphical mode:

sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config
echo "xfce4-session" | tee ~/.xsession

Enable the login manager at system startup so that it runs every time the server boots:

systemctl enable xdm.service

Set Russian as the default system locale:

update-locale LANG=ru_RU.UTF-8 
echo 'FRAMEBUFFER=Y' >> /etc/initramfs-tools/initramfs.conf 
update-initramfs -u -k `uname -r`

Add the Russian keyboard layout for the applet:

xkbO='grp:alt_shift_toggle' && sed -i 's/XKBOPTIONS=\"\w*"/XKBOPTIONS=\"'$xkbO'\"/g' /etc/default/keyboard 
xkbL='us,ru' && sed -i 's/XKBLAYOUT=\"\w*"/XKBLAYOUT=\"'$xkbL'\"/g' /etc/default/keyboard

Reinstall the locales package to update the configuration files:

apt install --reinstall locales -y

3. Reboot the server.

4. After the reboot, go to the "Console" tab in the control panel. The login manager will appear there.

Enter your username and password (the password is not displayed as you type) and press Enter.

Installing the XFCE Desktop Environment on Ubuntu

5. After you enter your credentials, the graphical interface opens along with a dialog box where you need to choose the default panel configuration.

Installing the XFCE Desktop Environment on Ubuntu

Done: the interface is installed and ready to use. Now you need to add support for the Russian keyboard layout on the server.

6. Add the keyboard applet to the panel so you can switch between layouts. To do this, right-click "Applications" in the upper-left corner and select "Panel" - "Add New Items":

Installing the XFCE Desktop Environment on Ubuntu

7. In the window that opens, select "Keyboard Layouts" and click "Add":

Installing the XFCE Desktop Environment on Ubuntu

8. A flag icon will appear in the upper-right corner. Right-click it and select "Keyboard settings":

Installing the XFCE Desktop Environment on Ubuntu

9. In the new window, go to the "Layout" tab, clear the "Use system defaults" check box, and click "Add":

Installing the XFCE Desktop Environment on Ubuntu

10. Select the Russian layout from the list and click "OK".

You can close the "Keyboard" window.

You can now switch between the English and Russian layouts by simply clicking the flag icon:

Installing the XFCE Desktop Environment on Ubuntu

Installing a Browser

Sometimes there may be problems with the default browser in XFCE. We recommend also installing popular browsers such as Chromium and/or Firefox and using them instead.

To install them, open an SSH console and run the following command:

apt install firefox chromium-browser

Managing the Server via RDP

After installing the desktop environment, you can manage the server through the console in the control panel or connect remotely over the RDP protocol.

To set up remote connections, install the xRDP server on your VPS:

apt-get install xrdp

Then enable it at startup:

systemctl enable xrdp

After installation, you can connect to the server and manage it via RDP, just as you would manage Windows servers remotely. Make sure port 3389 is open (on our cloud servers it is open by default).

Troubleshooting

Disconnection After Successful Login

In recent versions of Ubuntu (20.04 and later), the RDP session may disconnect 2–3 seconds after a successful login. To fix this, make the following changes to the /etc/xrdp/startwm.sh file, placing them before the line that starts with test -x:

unset DBUS_SESSION_BUS_ADDRESS 
unset XDG_RUNTIME_DIR
if test -r /etc/profile; then 
. /etc/profile 
fi 
unset DBUS_SESSION_BUS_ADDRESS 
unset XDG_RUNTIME_DIR 
test -x /etc/X11/Xsession && exec /etc/X11/Xsession 
exec /bin/sh /etc/X11/Xsession

After making the changes, restart the XRDP service:

systemctl restart xrdp

Blank Screen

Another possible problem is a blank screen when connecting via RDP. This problem was found on Ubuntu 18.04, but it can occur in other versions as well. To fix it, you can use the method described in the previous section.

No Display

Another XRDP server problem is a missing display (the connection window may open and immediately close without showing any errors). To fix it, you need to edit the /etc/xrdp/startwm.sh file.

Find and delete the following lines from the file:

test -x /etc/X11/Xsession && exec /etc/X11/Xsession
exec /bin/sh /etc/X11/Xsession

Replace them with the following line:

startxfce4

After making the changes, restart the XRDP service:

systemctl restart xrdp

Have more questions about Hosting?