Installing snap on Red Hat Enterprise Linux (RHEL)

Snap is available for Red Hat Enterprise Linux (RHEL) 9.x, RHEL 8 and RHEL 7, from the 7.6 release onwards. It’s also available for CentOS 7.6+ (see Installing snap on CentOS).

The packages for RHEL are in the distribution’s respective Extra Packages for Enterprise Linux (EPEL) repository. The instructions for adding this repository diverge slightly between RHEL9, RHEL 8 and RHEL 7, which is why they’re listed separately below.

:information_source: If you need to know which version of Red Hat you’re running, type cat /etc/redhat-release.

If you don’t already have the EPEL repository added to your distribution, it can be added as follows:

Adding EPEL to RHEL 9

The EPEL repository can be added to a RHEL 9 system with the following command:

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo dnf upgrade

:information_source: If you’re interested in understanding how these packages are built, see Building a snap RPM for Red Hat Enterprise Linux (RHEL) 8.

Adding EPEL to RHEL 8

The EPEL repository can be added to a RHEL 8 system with the following command:

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf upgrade

:information_source: If you’re interested in understanding how these packages are built, see Building a snap RPM for Red Hat Enterprise Linux (RHEL) 8.

Adding EPEL to RHEL 7

The EPEL repository can be added to a RHEL 7 system with the following command:

sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Adding the optional and extras repositories is also recommended:

sudo subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"
sudo yum update

Installing snapd

With the EPEL repository added to your RHEL installation, the next step is to install the snapd package:

sudo yum install snapd

Once installed, the systemd unit that manages the main snap communication socket needs to be enabled:

sudo systemctl enable --now snapd.socket

To enable classic snap support, enter the following to create a symbolic link between /var/lib/snapd/snap and /snap:

sudo ln -s /var/lib/snapd/snap /snap

Either log out and back in again or restart your system to ensure snap’s paths are updated correctly.

Snap is now installed and ready to go! If you’re using a desktop, a great next step is to install the Snap Store app.

Been trying to verify these steps myself. Some details about my setup:

  • Red Hat 8 with trial subscription
  • Machine is a HyperV Gen 2 VM

Steps and results:

  • sudo rpm ... succeeds

  • sudo subscription-manager repos ... fails with the following errors:

    Error: 'rhel-*-optional-rpms' does not match a valid repository ID...
    Error: 'rhel-*-extras-rpms' doesn not match a valid repository ID...
    
  • sudo yum install snapd fails with the following errors:

    Problem 1: cannot install the best update candidate for package annobin-8.64-1.el8.x86_64
     - nothing provides librpm.so.3()(64bit) needed by annobin-8.64-1.el8.x86_64
     - nothing provides librpmio.so.3()(64bit) needed by annobin-8.64-1.el8.x86_64
    Problem 2: cannot install the best update candidate for package libidn2-2.0.5-1.el8.x86_64
     - nothing provides libunistring.so.0()(64bit) needed by libidn2-2.0.5-1.el8.x86_64
    

    Running the command again with --nobest reports the same errors but appears to complete successfully.

  • sudo yum install snapd fails with the following errors:

    Problem: package snapd-2.39.2-1.el7.x86_64 requires snapd-selinux = 2.39.2-1.el7, but none of the providers can be installed
     - conflicting requests
     - nothing provides policycoreutils-python needed by snapd-selinux = 2.39.2-1.el7.noarch
    
    The `--nobest` option does not work.
    
    

At this point, I’m stuck… I’m also going to try installing directly onto bare metal, but we’ll see.

Hi @craxal

Thanks for the feedback! It might be best to post this as a new topic in the snapd category to see if anybody can help you get the right instructions.

Not many people follow the docs category so really need to be lucky to get support here.

(and @craxal) We’re actually looking into this now - it’s certainly an issue for the docs category if the instructions don’t work, so we’re trying to reproduce the problem and find a fix - I’ve just been through the same process with RHEL 8 and encountered the same problem.

not many, but the right ones :smiley:

I’ve commented on this issue here:

With the release of snapd for RHEL 8, all this is no longer an issue. Thanks for all the help!

I tried to install in RHEL 8 laptop with EPEL enabled, but failed with below error message:

[sahmatra@sahmatra ~]$ sudo yum install snapd
This system is receiving updates from Spacewalk server.
Updating Subscription Management repositories.
Unable to read consumer identity
Last metadata expiration check: 0:20:31 ago on Mon 20 Jan 2020 04:17:54 PM +08.
Error:
Problem: package snapd-2.42.2-1.el8.x86_64 requires snapd-selinux = 2.42.2-1.el8, but none of the providers can be installed

  • conflicting requests
  • nothing provides selinux-policy-base >= 3.14.3-20.el8 needed by snapd-selinux-2.42.2-1.el8.noarch
    (try to add ‘–skip-broken’ to skip uninstallable packages or ‘–nobest’ to use not only best candidate packages)

Thank you

Is that RHEL8 proper or CentOS 8? It does work on me on the following system:

[guest@rhel-8-devel ~]$ cat /etc/os-release 
NAME="Red Hat Enterprise Linux"
VERSION="8.1 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.1"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.1 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.1:GA"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

I managed to do it through a log of sweat. Basically, every dependency needs to be installed manually from centos.pkgs.org. I posted my steps here: https://stackoverflow.com/questions/74960690/try-to-install-snapd-but-giving-conflicting-requests-error/75035419#75035419

1 Like

Hi would you please add a session for RHEL9, although it just needs to update the source link from 8 to 9 “https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm”, but I think this help some users who is not really familiar with RHEL, they will use epel8 for RHEL9, thank you.

1 Like

Hello! Thanks so much for letting me know. I’m going to download RHEL 9 this afternoon, give it a go, and then update the doc here.

1 Like

Why does this doc end like right in the middle? I feel like a for a ton of people what is propagated as “The end” here is for many by far not the end. Like I ain’t no coding whiz who is born inherently with the knowledge where which direction trees and shit like that belong. And I actually find it only rarely communicated properly. Anyway, so I was winging it with this documentation and the resulting reasearch because a lack of content about what this is all entailing. I was creating “/var/lib/snapd/snap” wherever I hope that tree belongs. I just created it where I HOPE it belongs. Then after some further research I was going into home creating “~/remote/users/”(Home directories outside of '/home') folder in hope that it is the correct place. There then I found out that there is the need for something like a configure hook core snap thing and I was wondering why this wasn’t mentioned in the first place. Also there should be a possibility to sent in such issues without logging in.

Thanks for your comment. Can you please clarify what the issue at hand is?

To clarify, the instructions cover setting up snapd on RHEL. The snippet you referred to describes the step needed to enable support for ‘classic’ snaps (which are similar to regular packages), what is stated clearly in the paragraph just above said snippet. I am not sure how/why you ended up creating ~/remote/users directories, as the relevant piece of documentation uses /remote/users to begin with and clearly states that it’s just an example and you need to replace it with a path that is correct for your system. HTH.

Has anyone seen this FIPS error trying to run snap on RHEL8 - with SELinux and FIPS enabled. (“yum install snapd” installed version 2.65.1)

“cannot check or enable FIPS mode: readlink /snap/snapd/current: no such file or directory”

Thanks for any ideas! - Rob

Hi @robbyb69. I’ve just tested this on my RHEL installation, and I don’t have the same error. Maybe @mborzecki1 has some idea.

Hi, sorry for the inconvenience. This is related to FIPS support which started around 2.64 timeframe and continued until 2.66. The 2.66.1 release, which already has the necessary patch, should be made available soon, but if it is further delayed, we’ll do a distro patch in Fedora and EPEL. In the meantime you can try downgrading.