- Posted on
- • Administration
Combining Snap with APT repositories effectively
- Author
-
-
- User
- Linux Bash
- Posts by this author
- Posts by this author
-
As Linux continues to be a popular choice for developers and enthusiasts alike, mastering package management systems is essential for efficient system administration and software management. Two major tools in the Linux ecosystem are APT (Advanced Package Tool) and Snap. While APT is traditionally used with Debian and Ubuntu distributions, Snap is a newer, cross-distribution package management system developed by Canonical, the company behind Ubuntu.
Combining the capabilities of APT and Snap allows users to leverage the stability of Debian packages alongside the flexibility and security of Snaps. Here’s how to effectively combine these tools within your Linux system.
Understanding APT and Snap
APT is a package management system used by Debian and its derivatives such as Ubuntu. It is known for its robustness and extensive software repositories. It handles the installation and removal of software, including dependencies resolution.
Snap packages, often just called Snaps, are containerised software packages that are simple to create and install. They are autonomous, yet securely confined through built-in mechanisms and can auto-update. Since Snaps bundle most of their dependencies, they work across a variety of Linux distributions without modification.
Setting Up Your System
Debian and Ubuntu
Most Debian-based distributions including Ubuntu come with APT pre-installed. You can install Snap by running the following:
sudo apt update
sudo apt install snapd
Once installed, the Snap service should start automatically. You can verify this with:
systemctl status snapd
Fedora
Fedora uses dnf
as its default package manager. To install Snap on Fedora:
sudo dnf install snapd
sudo ln -s /var/lib/snapd/snap /snap # This enables classic snap support
openSUSE
On openSUSE, zypper
is the default package manager. To install Snap:
sudo zypper addrepo --norefresh --gpgcheck -y https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.2 snappy
sudo zypper --gpg-auto-import-keys install snapd
Using APT and Snap Together
Installing Software
When choosing between APT and Snap for installing software, consider the following:
Use APT if you are looking for maximum system integration and possibly needing a version that aligns closely with your distribution’s release cycle.
Use Snap when you want to get software updates directly from the software vendor, need an application isolated with newer dependencies than those in your current system, or when you are on a different Linux distribution than the target deployment for the app.
Example: Installing VLC media player.
Using APT:
sudo apt update
sudo apt install vlc
Using Snap:
sudo snap install vlc
Updating Packages
With APT:
sudo apt update
sudo apt upgrade
With Snap, updates are handled automatically in the background. However, to manually update all installed Snaps:
sudo snap refresh
Coexistence and Possible Conflicts
While APT and Snap can coexist on the same system, there can be potential conflicts or duplication if both versions of the same application are installed. To avoid confusion:
Prefer one package manager for a particular application.
Use
which <command>
ortype <command>
to determine the path of the executable if needed.
Conclusion
Combining Snap with APT adds flexibility and increases the range of software available on your system. By using Snap, you can take advantage of quicker updates and stricter confinement, while APT provides deep system integration. Understanding when to use each tool will help you maintain a robust and efficient Linux environment.
Remember, as with any system changes, back up important data before making significant modifications to your system software.