Use Element and Matrix on Linux
Install Element via Flatpak on any Linux distro, configure encrypted DMs, back up your Matrix encryption keys, and pick the right homeserver for your needs.
Before you start
- ▸A working Linux desktop with internet access
- ▸Flatpak installed, or ability to install it via your package manager
- ▸A password manager or secure location to store your Matrix Security Key
- ▸Basic familiarity with your distro's terminal
Matrix is an open, federated protocol for real-time communication — think of it as email, but for chat, where anyone can run a server and still talk to everyone else. Element is the flagship Matrix client, polished enough for daily use and available on every major Linux distro via Flatpak. This guide walks through installing Element, choosing a homeserver, locking down your account with encrypted DMs, and backing up your encryption keys so you never lose message history.
Choosing a Homeserver
Your homeserver is where your account lives. It stores your profile, room memberships, and (encrypted) message metadata. You have three realistic options:
- matrix.org — the flagship public server run by the Matrix Foundation. Free, no sign-up beyond the web form, but heavily loaded and occasionally slow. Fine for evaluation.
- Third-party public servers — servers like
envs.net,mozilla.org(Mozilla staff/community), ortchncs.derun by trusted community operators. Check servers.joinmatrix.org for a curated list with uptime stats. - Self-hosted Synapse or Dendrite — full control, but requires a VPS, a domain, and basic sysadmin work. Out of scope here, but worth planning for if privacy is critical.
Your choice of homeserver does not lock you in to talking only to people on that server — federation means you can join rooms and DM users on any other server. It does affect your data residency, uptime dependency, and account portability (migration is improving but still imperfect as of 2024).
Installing Element via Flatpak
Flatpak is the best cross-distro install path for Element. It stays current, sandboxes the app, and avoids depending on whatever version your distro ships in its repos (often months behind).
Step 1 — Install Flatpak and add Flathub
Skip this step if Flatpak is already set up on your system.
# Debian / Ubuntu
sudo apt install flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# Fedora (Flatpak is pre-installed; Flathub may need enabling)
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# Arch
sudo pacman -S flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
Log out and back in (or reboot) after adding Flathub so your desktop environment picks up the new portal integrations.
Step 2 — Install Element
flatpak install flathub im.riot.Riot
The app ID is still im.riot.Riot for historical reasons; the installed app shows up as "Element" in your launcher.
Step 3 — Launch Element
flatpak run im.riot.Riot
Or find it in your application menu under "Element". On first run you will see options to sign in or create an account.
Creating an Account and Signing In
On the welcome screen, click Create Account. The default homeserver shown is matrix.org. To use a different server, click Edit next to the server name and type the server's URL (e.g., https://envs.net). Register with a username and strong password — Matrix usernames take the form @username:homeserver.tld.
If you already have an account, click Sign In, then adjust the homeserver field before entering credentials. Element will fetch the server's well-known configuration automatically.
Setting Up Encrypted DMs
Matrix end-to-end encryption (E2EE) uses the Olm/Megolm cryptographic library. Each device generates its own key pair. When you start a DM, encryption is negotiated per-device, not per-account — this matters when you use Element on multiple devices.
Starting an encrypted DM
- Click the + button next to "People" in the left sidebar, or use the compose icon.
- Type the Matrix ID of the person you want to message (e.g.,
@alice:matrix.org). - Click Go. Element automatically enables encryption for direct messages.
- A padlock icon in the message composer confirms encryption is active.
For group rooms, encryption is opt-in and must be enabled at room creation — it cannot be toggled off once enabled. When creating a room click More options and turn on Enable end-to-end encryption.
Verifying other users
Encryption without verification protects against server-side snooping but not against a compromised server injecting a key. Verify contacts by clicking their name in a DM, then Verify. You will compare emoji or a numeric code out-of-band (voice call, in person). Once verified, their messages show a green shield.
Backing Up Your Encryption Keys
This is the step most beginners skip — and then lose all their encrypted message history when they log out or reinstall. Matrix encryption keys live on your device. If you lose them, old encrypted messages are gone permanently.
Step 4 — Enable Secure Backup
- Open Settings (click your avatar, bottom-left).
- Go to Security & Privacy.
- Under Secure Backup, click Set up.
- Choose Generate a Security Key. Element generates a random key that looks like:
EsTR-Wdxk-Qmvj-NpLc-Hrft-Qzbn-Axke-Lmwd(yours will differ). - Save this key somewhere safe — a password manager like Bitwarden or KeePassXC is ideal. Do not store it only in the cloud without offline backup.
- Click Continue to finish setup.
With Secure Backup enabled, your keys are uploaded to your homeserver in encrypted form. When you log in on a new device or after reinstall, Element retrieves and decrypts them using your Security Key.
Restoring keys on a new device
After logging in on a new installation, Element will prompt you to verify the session. Click Use Security Key, paste the key you saved, and your message history decrypts automatically.
Useful Element Settings to Configure
- Notifications — Under Settings → Notifications, tune keyword alerts and disable noisy defaults like "All messages in all rooms."
- Theme — Settings → Appearance → Dark/Light/System. Wayland users: Element on Flatpak follows the system color scheme via the xdg-desktop-portal when the portal is correctly configured.
- Message bubbles — Settings → Appearance → Message layout. "Modern" (bubbles) is easier to read for DMs; "IRC" layout suits power users in busy rooms.
- Cross-signing — If you use Element on a phone as well, go through the cross-signing verification flow between devices so both show green shields.
Verifying Your Installation
Run a quick sanity check from the terminal:
flatpak info im.riot.Riot
Output will show the installed version, branch (stable), and installation path. Check that the version matches the current release on Flathub. Inside Element, open Help & About (Settings → Help & About) to confirm the version and that encryption is listed as supported.
Troubleshooting
"Unable to connect to homeserver"
Confirm you can reach the server's federation port. matrix.org occasionally has degraded service — check status.matrix.org. For custom servers, verify the .well-known/matrix/client endpoint responds correctly.
Encrypted messages show as "Unable to decrypt"
This almost always means the sending device's keys were never received. Ask the sender to open their session list (Settings → Security → Session Manager) and verify or re-share keys. If messages are from before you set up Secure Backup, they are unrecoverable.
Element is blank or crashes on Wayland
Element's Flatpak runs Electron under XWayland by default. If you hit rendering bugs under a pure Wayland compositor, try forcing XWayland explicitly:
flatpak run --env=ELECTRON_OZONE_PLATFORM_HINT=auto im.riot.Riot
Or disable hardware acceleration in Element's Settings → Labs if crashes persist.
Keeping Element updated
flatpak update im.riot.Riot
Most desktop environments with Flatpak integration (GNOME Software, Discover) handle this automatically. Check monthly at minimum since Element ships security fixes regularly.
Frequently asked questions
- Can I keep my account if I switch homeservers?
- Full account portability is not yet available in Matrix as of 2024. You can export some data, but you cannot move your account ID or room history to a new server. Choose your homeserver carefully, or plan to create a new account and notify contacts.
- Is matrix.org safe to use for private conversations?
- With E2EE enabled, message content is encrypted before it leaves your device — the matrix.org server cannot read it. However, metadata (who you talk to, when) is visible to your homeserver. For stronger metadata privacy, self-hosting is the most reliable option.
- Why do I need a Security Key if my messages are already encrypted?
- Encryption keys are generated per-device and stored locally. Without Secure Backup, logging out or reinstalling destroys those keys and you permanently lose access to old encrypted messages. The Security Key lets your homeserver store an encrypted copy of your keys for recovery.
- Can I use Element alongside other Matrix clients like Fluffychat or Cinny?
- Yes. Multiple clients can be logged into the same Matrix account simultaneously. Cross-signing lets each client verify the others so encrypted messages stay readable across all of them. Run the verification flow between clients after logging in.
- Does the Flatpak version of Element have any limitations compared to native packages?
- Flatpak Element is sandboxed, so some system integrations like custom notification sounds or deep desktop portal features may behave differently. Native .deb or .rpm packages from Element's own repository offer tighter desktop integration if you hit Flatpak-specific issues.
Related guides
Linux Clipboards Explained (+ Clipboard Managers)
Learn the difference between Linux's PRIMARY and CLIPBOARD selections, use xclip, xsel, and wl-clipboard from the terminal, and manage history with GPaste or Klipper.
Configure LibreOffice for Daily Use
Configure LibreOffice for daily use: set default save formats for MS Office interop, tune autosave, install fonts, and add productivity extensions.
Configure the Touchpad and Multitouch Gestures
Configure Linux touchpad behavior and multitouch gestures using libinput, libinput-gestures, and native GNOME and KDE Plasma settings on both Wayland and X11.
Wayland vs X11: How to Choose and Configure Each
Know when to run Wayland or X11, how to check your current session, switch at login with GDM/SDDM/LightDM, and handle NVIDIA and XWayland edge cases.