How to Install Okular on Ubuntu 24.04, 22.04 or 20.04

Okular is a versatile and powerful document viewer developed by the KDE community, supporting a wide range of formats including PDF, EPUB, DjVu, and more. It offers advanced features such as text highlighting, annotations, bookmarks, and the ability to extract text and images, making it an ideal tool for both casual users and professionals who need to work with various document types.

On Ubuntu 24.04, 22.04, or 20.04, you have several methods to install Okular. The first and simplest method is via the Ubuntu default repository, which provides a stable and reliable version of the software. Alternatively, you can install Okular using Snap, available through Snapcraft, or via Flatpak with Flathub, both of which offer containerized environments that ensure you are running the latest or preferred version. This guide will walk you through all three installation methods, allowing you to choose the best one for your needs.

Method 1: Install Okular via APT

Update Ubuntu Packages are Updated Before Okular Installation

First, ensure your system is up-to-date with the following command:

sudo apt update && sudo apt upgrade

Install Okular via APT Command

Once your system is updated, we’re ready to install Okular. The Ubuntu default APT repository offers a stable and secure version of Okular, which makes it a highly recommended option for installation. While it might not always be as up-to-date as the Flatpak version, the APT repository is known for its robust, tried-and-true packages.

To install Okular from the APT repository, you’ll need to execute the following command in your Terminal:

sudo apt install okular

Upon running this command, your system will reach out to the Ubuntu repositories, fetch the Okular package, and proceed with the installation. Once complete, you will successfully install Okular on your Ubuntu system through the APT repository.

As we continue, we’ll explore alternate installation methods, which can be useful depending on your specific requirements.

Method 2: Install Okular via Snap

Snapcraft, commonly called ‘Snap,’ offers another pathway to installing Okular. It’s a universal package manager created by Canonical (the maker of Ubuntu) that simplifies the installation process and ensures you always have the latest application version. Unless previously removed, it should be available on your Ubuntu desktop by default.

Install Okular via Snap Command

With the preparations complete, we’re ready to install Okular using Snap. Thanks to Snap’s universality, this command is straightforward. Input the following command to install Okular:

sudo snap install okular

As before, sudo grants administrative privileges, snap install instructs the system to install a Snap package, and okular is the specific package we’re installing.

Once this command is complete, you will have successfully installed Okular on your Ubuntu system using the Snapcraft package manager.

Method 3: Install Okular via Flatpak and Flathub

In this section, we’ll dive into another method of installing Okular: using the Flatpak package manager. Flatpak is a universal package management system that makes applications available across various Linux distributions. It operates in a sandbox environment, isolating applications from the central system, which enhances system security and stability.

Note: If your system doesn’t already have Flatpak installed, follow our step-by-step guide on “How to Install Flatpak on Ubuntu” to get up and running with the most recent supported version of Flatpak.

Enabling Flathub for Okular

Our first step in this journey is to enable the Flathub repository. Flathub is a vibrant app store that hosts a multitude of Flatpak applications. It’s like an ever-expanding library, ensuring you have various applications, including Okular.

To add the Flathub repository to your Flatpak configuration, execute the following command:

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

In this command:

  • sudo grants administrative privileges needed for adding a repository.
  • flatpak remote-add is the command to add a new repository to Flatpak.
  • –if-not-exists is a safety mechanism that prevents Flatpak from returning an error if Flathub is already added to the configuration.
  • flathub is the name assigned to the repository.
  • https://flathub.org/repo/flathub.flatpakrepo is the URL of the Flathub repository.

Once you’ve run this command, your system is set to fetch and install applications from Flathub.

Install Okular via Flatpak

With Flathub at our disposal, we’re all set to install Okular. The Flatpak version of Okular can be fetched directly from the Flathub repository, ensuring you’re getting the latest version.

Enter the following command to install Okular:

flatpak install flathub org.kde.okular -y

In this command:

  • flatpak install instructs the system to install a Flatpak package.
  • flathub points to the repository that the package will be fetched from.
  • org.kde.okular is the specific package we’re installing.
  • -y is an optional parameter that automatically answers ‘yes’ to any prompts, streamlining the install process.

Once the process is complete, you’ll successfully install Okular via Flatpak and Flathub.

Launching Okular

Congratulations on successfully installing Okular! Now, let’s shift gears and focus on how to launch this versatile document viewer on your Ubuntu Linux system. Depending on your preferred method and the package management system used for installation, there are several ways to start using Okular.

Launching Okular from the Terminal

To begin with, you can launch Okular directly from your Terminal. This method can be handy when operating within the terminal environment. The command to start Okular is as straightforward as:

okular

Running this command searches for the Okular application within your system and initiates it promptly.

If you installed Okular using Snapcraft, the command to launch Okular is slightly different:

snap run okular

In this command, snap run instructs the Snapcraft system to execute the application following it, in this case, okular.

For those who installed Okular via Flatpak, the command to start Okular takes a different form:

flatpak run org.kde.okular

Here, flatpak run prompts the Flatpak system to execute the specified application, identified by org.kde.okular.

Launching Okular from the Desktop

While running Okular from the Terminal is efficient, it’s not always the most practical or user-friendly method, especially if you frequently interact with a graphical desktop environment.

To launch Okular from your desktop:

  1. Click on ‘Activities’ located at the top-right corner of your desktop.
  2. Select ‘Show Applications’.
  3. Search for ‘Okular’ in the application list.

Managing Okular

Update Okular

One of the benefits of software updates is getting access to the latest features, improved security, and bug fixes. Ubuntu’s system regularly checks for updates and notifies you about them. However, in certain scenarios, these notifications may not appear. That’s when you need to take the reins and manually check for updates using the Terminal. Here’s how you do it based on the installation method you followed:

APT Update Terminal Command for Okular

For installations done via the APT package manager, enter the following command in your Terminal:

sudo apt update

This command updates the package list on your Ubuntu system, including Okular.

Flatpak Update Terminal Command for Okular

For those who have installed Okular using Flatpak, you can update your software with the following command:

flatpak update

This command checks for updates in your Flatpak applications and installs them.

Snap Update Terminal Command for Okular

If you have used Snap to install Okular, update it using the command below:

sudo snap refresh

This command will update all your Snap applications, including Okular.

Remove Okular

There might come a time when you no longer require Okular on your Ubuntu system. Here’s how to uninstall it based on your original installation method:

APT Remove Terminal Command for Okular

To remove Okular installed via the APT package manager, use the following command:

sudo apt remove okular

Flatpak Remove Terminal Command for Okular

If Okular was installed using Flatpak, use the following command to remove it:

flatpak remove  --delete-data org.kde.okular -y

Snap Remove Terminal Command for Okular

For Okular installed via Snap, you can uninstall it using the following command:

sudo snap remove okular

Closing Thoughts

With Okular installed on your Ubuntu system, you can enjoy a feature-rich and versatile document viewer that meets a variety of needs. Whether you prefer the stability of the Ubuntu default repository, the convenience of Snap, or the flexibility of Flatpak, each method ensures you have access to the latest features and updates. Regular updates through these methods will keep your installation current, allowing you to make the most of Okular’s powerful capabilities on Ubuntu.

Leave a Comment