Install Flatpak on Centos 7: Powerful Package Manager
In this guide, you will learn to Install Flatpak on Centos 7 and start using it to search and install packages. Flatpak is a software package management utility. It is secure and you don’t need to worry about the dependencies and libraries that are needed to install a program or app. With Flatpak you can easily add repositories to find and download apps. Now follow the steps below on the Orcacore website to Install Flatpak on Centos 7.
To enable Flatpak Centos, you must have access to your server as a non-root user with sudo privileges. To do this, you can follow this guide on Initial Server Setup with Centos 7.
Now follow the steps below to complete this guide on Flatpak Centos Setup.
Step 1 – Enable Flatpak on Centos 7
First, you need to run the system update with the following command:
sudo yum update -y
The Flatpak package is available on the default Centos repository. To install it, simply run the following command:
sudo yum install flatpak -y
Verify your Flatpak installation by checking its version:
flatpak --version
**Output**
Flatpak 1.0.9
Step 2 – Install Flathub Repository File on Centos 7
Before you start to use your Flatpak package manager, you need to enable Flathub on your Centos 7. Flathub is a platform that is used for searching applications.
To enable Flathub, you can use the following Flatpak command:
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Step 3 – How To Search Apps with Flatpak?
Now that you have enabled Flathub, you can easily start using your Flatpak Centos.
To search for an application, you can use the following syntax:
flatpak search <Application_name>
For example, we want to search for OpenJDK:
flatpak search openjdk
In your output, you will see:
**Output**
Application ID Version Branch Remotes Description
org.freedesktop.Sdk.Extension.openjdk8 22.08 flathub OpenJdk 8 Sdk extension
org.freedesktop.Sdk.Extension.openjdk8 21.08 flathub OpenJdk 8 Sdk extension
org.freedesktop.Sdk.Extension.openjdk8 20.08 flathub OpenJdk 8 Sdk extension
org.freedesktop.Sdk.Extension.openjdk17 22.08 flathub The LTS (long term support) version of the OpenJDK JRE and JDK
org.freedesktop.Sdk.Extension.openjdk17 21.08 flathub The LTS (long term support) version of the OpenJDK JRE and JDK
org.freedesktop.Sdk.Extension.openjdk17 20.08 flathub The LTS (long term support) version of the OpenJDK JRE and JDK
org.freedesktop.Sdk.Extension.openjdk11 22.08 flathub The LTS (long term support) version of the OpenJDK JRE and JDK
org.freedesktop.Sdk.Extension.openjdk11 21.08 flathub The LTS (long term support) version of the OpenJDK JRE and JDK
org.freedesktop.Sdk.Extension.openjdk11 20.08 flathub The LTS (long term support) version of the OpenJDK JRE and JDK
org.freedesktop.Sdk.Extension.openjdk11 19.08 flathub The LTS (long term support) version of the OpenJDK JRE and JDK
org.freedesktop.Sdk.Extension.openjdk11 18.08 flathub The LTS (long term support) version of the OpenJDK JRE and JDK
org.freedesktop.Sdk.Extension.openjdk 20.0.1+9 22.08 flathub The latest version of the OpenJDK JRE and JDK
org.freedesktop.Sdk.Extension.openjdk 21.08 flathub The latest version of the OpenJDK JRE and JDK
org.freedesktop.Sdk.Extension.openjdk 20.08 flathub The latest version of the OpenJDK JRE and JDK
org.freedesktop.Sdk.Extension.openjdk 19.08 flathub The latest version of the OpenJDK JRE and JDK
org.freedesktop.Sdk.Extension.openjdk 18.08 flathub The latest version of the OpenJDK JRE and JDK
Step 4 – How To Install an App with Flatpak?
When searching for your App is completed, you can easily install your desired application by using the following syntax:
flatpak install flathub <Application_ID>
For example, install OpenJDK 17 with Flatpak:
flatpak install flathub org.freedesktop.Sdk.Extension.openjdk17//22.08
It will ask you if you want to install it. Press y to continue. Then, wait for your download process to complete.
When your installation is completed, you will get the following output:
Step 5 – How To Uninstall an App with Flatpak?
To uninstall an App with Flatpak Centos, you can use the following syntax:
flatpak uninstall APP-ID
For example:
flatpak uninstall org.freedesktop.Sdk.Extension.openjdk17//22.08
**Output**
Uninstalling from system:
org.freedesktop.Sdk.Extension.openjdk17/x86_64/22.08
Is this ok [y/n]: y
Uninstalling: org.freedesktop.Sdk.Extension.openjdk17/x86_64/22.08
For more information, you can visit the Flatpak Docs page.
Step 6 – How To Uninstall Flatpak From Centos 7?
If you no longer want to use Flatpak Centos, you can easily remove it with the command below:
sudo yum autoremove flatpak -y
Conclusion
At this point, you have learned to install the Flatpak package manager on your Centos 7. Also, you have learned to enable the Flathub repository so that you can use your Flatpak package manager. As you can see in the guide, you can easily search for your app and install it on your server without needing to install dependencies.
Hope you enjoy it. You may also like these articles:
Disable systemd-resolved on Centos 7
Install PowerDNS and PowerAdmin on Centos 7
Alternative Solutions for Package Management on Centos 7
While Flatpak offers a convenient and sandboxed approach to package management, especially for desktop applications, Centos 7 provides other options for installing software. Let’s explore two alternative solutions: using the standard yum
package manager and using Snap.
1. Using yum
Package Manager
yum
(Yellowdog Updater, Modified) is the default package manager for Centos 7 and relies on RPM (Red Hat Package Manager) packages. It’s tightly integrated with the system and handles dependencies automatically from configured repositories. This is a traditional and well-established method. While it doesn’t offer the sandboxing of Flatpak, it’s often the preferred method for installing system-level tools and libraries.
Explanation:
yum
works by downloading package metadata from configured repositories. When you install a package, yum
resolves dependencies by checking what other packages are required and installing them automatically. It ensures that the system remains consistent and stable.
Installation and Usage Example:
-
Search for a Package: Instead of
flatpak search
, you would useyum search
:yum search openjdk
-
Install a Package: Instead of
flatpak install
, you would useyum install
:sudo yum install java-1.8.0-openjdk-devel
Note: The package name for OpenJDK might differ slightly from the Flatpak ID. You’ll need to use the package name as found by
yum search
. Also, thejava-1.8.0-openjdk-devel
package is an example. You might need to install the JRE as well:java-1.8.0-openjdk
. The specific versions and package names available throughyum
depend on the configured repositories. -
Uninstall a Package: Instead of
flatpak uninstall
, you would useyum remove
:sudo yum remove java-1.8.0-openjdk-devel
Advantages of yum
:
- System Integration: Tightly integrated with the OS, making it suitable for core system components.
- Mature and Stable: A well-established and reliable package manager.
- Widely Used: Extensive documentation and community support available.
Disadvantages of yum
:
- No Sandboxing: Packages are installed directly into the system, which can potentially lead to conflicts or instability.
- Older Versions: Repositories might contain older versions of software compared to Flatpak or other more modern package managers.
2. Using Snap
Snap is another universal package manager, similar to Flatpak. It was originally developed by Canonical for Ubuntu, but it’s also available on other Linux distributions, including Centos 7. Like Flatpak, Snap packages are self-contained and include all their dependencies, offering a more isolated installation.
Explanation:
Snap packages, or "snaps," are containerized software packages that work across various Linux distributions. They bundle the application along with its dependencies, libraries, and configuration files into a single unit. This reduces dependency conflicts and simplifies application deployment.
Installation and Usage Example:
-
Enable the EPEL Repository: Snap isn’t directly available in the default Centos 7 repositories. You need to enable the EPEL (Extra Packages for Enterprise Linux) repository first:
sudo yum install epel-release -y
-
Install Snapd: Install the snap daemon (snapd), which manages snap packages:
sudo yum install snapd -y
-
Enable and Start Snapd:
sudo systemctl enable --now snapd.socket sudo systemctl start snapd
-
Create a Symbolic Link: Create a symbolic link for classic snap support:
sudo ln -s /var/lib/snapd/snap /snap
-
Log out and Log back in: Log out and log back in to your Centos 7 session for the snap environment variables to be properly configured. Or, you can source the /etc/profile file:
source /etc/profile
-
Find the OpenJDK Package (if available): Although OpenJDK may not be packaged as a Snap, this is how you’d generally search.
snap find openjdk
If OpenJDK is not packaged as a Snap, then you would look for a package to install as a snap that used OpenJDK.
-
Install a Snap:
sudo snap install <snap-name>
Replace
<snap-name>
with the actual name of the snap package you want to install. -
Uninstall a Snap:
sudo snap remove <snap-name>
Replace
<snap-name>
with the actual name of the snap package you want to uninstall.
Advantages of Snap:
- Self-Contained Packages: Reduces dependency conflicts and simplifies installation.
- Cross-Distribution Compatibility: Snaps are designed to work across different Linux distributions.
- Automatic Updates: Snapd automatically updates snap packages in the background.
Disadvantages of Snap:
- Larger Package Sizes: Snaps tend to be larger than traditional packages due to the included dependencies.
- Canonical Dependency: Heavily reliant on Canonical’s infrastructure.
- Availability: Not all software is available as a snap.
Choosing the Right Package Manager:
The best package manager for you depends on your specific needs and preferences.
- Flatpak: Ideal for desktop applications, especially when you want isolation and the latest versions.
yum
: Suitable for system-level tools, libraries, and core components where stability and integration are paramount.- Snap: A good alternative to Flatpak for cross-distribution compatibility and self-contained packages. However, consider its reliance on Canonical.
When choosing between these options, remember to assess the specific application requirements, the availability of packages, and the desired level of system integration and isolation. For installing Flatpak on Centos 7, you now have a solid understanding, as well as alternative methods for package management.