How to Install Okular on Ubuntu Linux

Okular is a document viewer developed by the KDE community, supporting a wide range of formats including PDF, EPUB, DjVu, CHM, XPS, and more. Additionally, it offers features such as text highlighting, annotations, bookmarks, and the ability to extract text and images, making it an ideal choice for students reviewing academic papers, professionals annotating contracts, or anyone who works with multiple document formats regularly.

This guide covers three installation methods: the Ubuntu default repository for stability, Snap for automatic updates, and Flatpak for sandboxed environments. By the end, you will have Okular installed and ready to open documents on your Ubuntu system.

Choose Your Okular Installation Method

Ubuntu provides multiple ways to install Okular. Accordingly, the following table compares each method to help you choose the best option for your needs.

MethodChannelVersionUpdatesBest For
APTUbuntu ReposDistribution defaultVia apt upgradeMost users who prefer stable, tested packages
SnapSnapcraftLatest stableAutomaticUsers wanting automatic background updates
FlatpakFlathubLatest stableVia flatpak updateUsers preferring sandboxed applications

For most users, the APT method is recommended because it integrates seamlessly with the Ubuntu desktop and receives security updates through standard system maintenance. Alternatively, choose Snap if you prefer automatic updates without manual intervention, or Flatpak if you want application sandboxing.

Method 1: Install Okular via APT

Update Ubuntu Packages

First, ensure your system packages are current. This step refreshes the package index and applies any pending security updates:

sudo apt update && sudo apt upgrade

Install Okular

With your system updated, next install Okular from the Ubuntu repository. The APT version is well-tested and integrates with the Ubuntu desktop environment:

sudo apt install okular

After the installation completes, verify that Okular is available by checking its package status:

apt-cache policy okular

As a result, the output confirms the installed version and repository source:

okular:
  Installed: 4:23.08.5-0ubuntu5
  Candidate: 4:23.08.5-0ubuntu5
  Version table:
 *** 4:23.08.5-0ubuntu5 500
        500 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages

Ubuntu 22.04 LTS includes Okular version 21.12.3, while Ubuntu 24.04 LTS ships version 23.08.5 as shown above. The installation commands work identically on both releases.

Method 2: Install Okular via Snap

Snap provides containerized applications that update automatically in the background. Since Ubuntu includes Snap by default, you can install Okular immediately without additional setup.

To begin, install Okular via Snap by running the following command:

sudo snap install okular

Once the installation completes, verify it by listing installed Snap packages:

snap list okular

In response, the output shows the installed Snap version and channel:

Name    Version   Rev   Tracking       Publisher   Notes
okular  24.08.3   196   latest/stable  kdeโœ“        -

Method 3: Install Okular via Flatpak and Flathub

Flatpak provides sandboxed applications that run isolated from the main system. As a result, this method is useful if you want the latest version with enhanced security through containerization.

Flatpak is not pre-installed on Ubuntu. If you have not set it up yet, install it with sudo apt install flatpak and restart your session before continuing. For detailed setup including the Flathub repository, follow our Flatpak installation guide for Ubuntu.

Enable Flathub Repository

Before installing Okular, first add the Flathub repository to your Flatpak configuration. The --if-not-exists flag ensures no error occurs if Flathub is already configured:

sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Install Okular via Flatpak

With Flathub configured, install Okular using the following command. The -y flag automatically confirms the installation prompts:

sudo flatpak install flathub org.kde.okular -y

After installation, verify that Okular is available by checking its Flatpak information:

sudo flatpak info org.kde.okular

Subsequently, the output confirms the installation details:

          ID: org.kde.okular
         Ref: app/org.kde.okular/x86_64/stable
        Arch: x86_64
      Branch: stable
      Origin: flathub

Launch Okular

Once installation is complete, you can launch Okular from the terminal or through the graphical desktop environment.

Launch from Terminal

Notably, the terminal command varies depending on your installation method:

APT installation:

okular

Snap installation:

snap run okular

Flatpak installation:

flatpak run org.kde.okular

Launch from Applications Menu

Alternatively, to launch Okular from the desktop environment:

  1. Click on โ€˜Activitiesโ€™ in the top-left corner of your screen.
  2. Type โ€˜Okularโ€™ in the search field.
  3. Click the Okular icon to launch the application.

Update Okular

Keeping Okular updated ensures you have the latest features and security fixes. Therefore, the update process depends on your installation method.

Update via APT

For APT installations, Okular updates alongside other system packages:

sudo apt update && sudo apt upgrade

Update via Snap

Snap packages update automatically in the background. However, you can manually trigger an update with:

sudo snap refresh okular

Update via Flatpak

Similarly, for Flatpak installations, update all installed applications with:

sudo flatpak update

Remove Okular

If you no longer need Okular, use the removal commands below that match your installation method.

Remove via APT

To remove an APT-installed Okular along with its configuration files, uninstall the main package with the --purge flag:

sudo apt remove --purge okular

Next, remove any orphaned dependencies that were installed with Okular but are no longer needed:

sudo apt autoremove

As a result, this cleans up KDE libraries and other packages that Okular required but are no longer used by other applications.

Remove via Snap

Alternatively, for Snap installations, remove Okular with:

sudo snap remove okular

Remove via Flatpak

To remove a Flatpak-installed Okular along with its application data:

sudo flatpak uninstall --delete-data org.kde.okular

Furthermore, clean up unused Flatpak runtimes that may have been installed as dependencies:

sudo flatpak uninstall --unused

Troubleshooting

Okular Fails to Launch with Display Error

If Okular fails to launch with an error about Qt platform plugins or display connection, the issue is typically related to missing Qt dependencies or running in a non-graphical environment. In this case, verify that you are logged into a graphical desktop session.

For Flatpak installations specifically, ensure you have restarted your session after installing Flatpak. Some desktop integration features require a fresh login to work correctly.

KDE Theme Not Applied

If Okular appears with a different theme than your desktop, this typically occurs because Okular is a KDE application and may not automatically adopt GTK themes. To resolve this on GNOME desktops, install the KDE Plasma integration package for better visual consistency:

sudo apt install kde-config-gtk-style

From there, configure theme settings in the KDE System Settings application if available, or adjust Qt theme settings through qt5ct.

Conclusion

You now have Okular installed on Ubuntu, giving you a capable document viewer for PDFs, EPUBs, and numerous other formats. In summary, the APT method provides stability with system-managed updates, Snap delivers automatic background updates, and Flatpak offers sandboxed isolation. For users working with KDE Plasma, consider our KDE Plasma installation guide on Ubuntu for full desktop integration with Okular and other KDE applications.

1 thought on “How to Install Okular on Ubuntu Linux”

  1. Okular is fantastic. Didn’t work stable from snap on Ubuntu 24.04LTS, via apt it’s working good
    Love it, simple and easy to adapt documents edited before

    Reply

Leave a Comment