Spotify is a digital music streaming service with both free and paid features. It is the world’s largest music streaming service provider, with over 381 million monthly active users, including 172 million paying subscribers, as of September 2021. Spotify can give you instant access to a vast online library of music and podcasts, which is very popular as you can listen to the content of your choice whenever you feel like it.
In the following tutorial, you will learn how to install the Spotify application on your Fedora 35 Workstation using three different methods.
Table of Contents
Prerequisites
- Recommended OS: Fedora Linux 35.
- User account: A user account with sudo or root access.
Update Operating System
Update your Fedora operating system to make sure all existing packages are up to date:
sudo dnf upgrade --refresh -y
The tutorial will be using the sudo command and assuming you have sudo status.
To verify sudo status on your account:
sudo whoami
Example output showing sudo status:
[joshua@fedora ~]$ sudo whoami
root
To set up an existing or new sudo account, visit our tutorial on Adding a User to Sudoers on Fedora.
To use the root account, use the following command with the root password to log in.
su
Install Dependency Required
Before you proceed with the installation, run the following command to install or check that the package dnf-plugins-core is installed on your Fedora desktop.
sudo dnf install dnf-plugins-core -y
By default, this should be installed.
The tutorial will utilize the terminal, which can be found in your show applications menu.
Example:
Install Option 1. Install Spotify with DNF
The first option is to use the RPM fusion third-party repository. This is the recommended way to install Spotify for Fedora users by utilizing the DNF package manager. However, it is a bit more of a process for this application, and other install options may seem a bit more desired, but the choice is yours.
Execute the following commands to import the free and non-free repositories into your terminal.
To enable the Free repository, use:
sudo dnf install \
https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm -y
To enable the Nonfree repository:
sudo dnf install \
https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm -y
Next, execute the following dnf install command:
sudo dnf install sudo dnf install lpf-spotify-client -y
Next, run the following command to add the username using Spotify to the pkg-build group to run lpf.
sudo usermod -a -G pkg-build <username>
If you forget, don’t panic. When you launch the lpf-spotify-client package, you will be prompted to do this.
Next, you must reboot your PC.
reboot
Next, run the following lpf-spotify-client package. This can be found in Activities > Show Applications > lpf spotify-client.
Example:
Accept the EULA Agreements to proceed.
Example:
A pop-up will now be shown, prompting you to enter your password a few times.
Example:
Halfway through the process, the final choice of Spotify RPMs to install will be shown. There should only be one selection for fresh installations. Select and hit ok. Note, you will more than likely be prompted to re-enter your password.
Example:
Very shortly after the last step, you will see a window informing you that Spotify was successfully installed. The Spotify icon will now be present in your Show Applications menu.
Example:
If you cannot launch Spotify correctly using the desktop shortcut and see the error GPU process is not usable, run the following command.
spotify --no-zygote
Do not use this command unless you are having issues, and you will need to rerun it in the future when you launch Spotify.
Spotify updates are handled using the standard dnf upgrade –refresh command.
sudo dnf upgrade --refresh
If you no longer wish to have Spotify installed with the DNF method, use the following command to remove the package.
sudo dnf remove lpf-spotify-client spotify-client
This will automatically remove any unused dependencies installed originally with Spotify and the lpf client.
Install Option 2. Install Spotify with Snap (Snapcraft)
The second option is to use the Snap package manager. Fedora users may be familiar with Snap as it is created and maintained by Ubuntu; however, it is not natively installed on your system. However, this can be installed relatively quickly.
To install Snap, use the following command:
sudo dnf install snapd
Example output:
Type Y, then press the ENTER KEY to proceed with the installation.
Next, some packages come in classic, so you need to create a symlink to enable classic snap support, which some packages still require off the Snapcraft repository.
sudo ln -s /var/lib/snapd/snap /snap
Next, to make sure the Snap paths have been generated correctly, you should reboot your PC now, or else you may have issues during your current session installing packages from Snapcraft.
reboot
Next, you need to install the “snap core files” for everything to work correctly. Failure to do this may result in issues down the track.
sudo snap install core
Example output:
core 16-2.52.1 from Canonical✓ installed
Next, install the Spotify package using snap:
sudo snap install spotify
Example output:
spotify 1.1.72.439.gc253025e from Spotify✓ installed
Snap packages are more significant in size than traditional repositories through the DNF package manager for several reasons. However, the trade-off is more straightforward maintained packages that are often updated to the latest available version.
For the future, to update along with and any other packages installed by Snap, run the following command:
sudo snap refresh
If you no longer need Spotify installed, remove it using the Snap remove command.
sudo snap remove spotify
Example output:
spotify removed
Troubleshooting Selinux
Snapcraft works mainly without touching Selinux, but you may find errors occurring. To generate a local policy module to allow access, use the following command if you find the Selinux error snap-update-ns.
ausearch -c 'snap-update-ns' --raw | audit2allow -M my-snapupdatens
semodule -X 300 -i my-snapupdatens.pp
Secondly, any errors around user lnk_file use the following in your terminal.
ausearch -c 'snapd' --raw | audit2allow -M my-snapd
semodule -X 300 -i my-snapd.pp
Install Option 3 – Install Spotify with Flatpak
The third option is to use the Flatpak package manager. Flatpak is installed by default on Fedora systems and is well respected as an alternative option to DNF package manager on its systems compared to Snapcraft, which is more popular on Debian/Ubuntu-based systems.
First, install the Flatpak package if you have removed it previously.
sudo dnf install flatpak -y
Next, you need to enable Flatpack for Fedora using the following command in your terminal:
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Now install Spotify using the following flatpak command.
flatpak install flathub com.spotify.Client
Example output:
Type Y twice, then press the ENTER KEY twice to install.
However, if you need to update manually, use the following command.
flatpak update
To remove the Flatpack version of Spotify, run the following command:
flatpak uninstall --delete-data com.spotify.Client
Example output:
Type Y and then ENTER KEY to proceed with the removal of Spotify using the Flatpak method.
Troubleshooting
The most common error with either icon shortcuts not generating or, for Spotify’s case with Flatpak, the application being blank when opened is to reboot your PC after the installation. This will permanently fix these issues.
How to Launch Spotify
Now that you have the Spotify client installed, launching can be done in two ways.
In your terminal type:
spotify
If you would like to launch Spotify and use the terminal, send it to the background:
spotify &
Alternatively, Flatpak users will need to launch using the command below from a terminal instance:
flatpak run com.spotify.Client
However, this isn’t practical, and you would use the following path on your desktop to open with the path: Activities > Show Applications > Spotify. If you cannot find it, use the search function in the Show Applications menu if you have many applications installed.
Example:
Once you open Spotify, you will see the first default landing screen. From here, you can sign or create an account.
Example:
Congratulations, you have successfully installed and launched Spotify.
Comments and Conclusion
In the tutorial, you have learned how to install Spotify on your Fedora 35 Workstation using three different methods, which you can change in the future if you prefer using one package manager over another. The most recommended way is to install the Spotify repository with DNF manager, but the other two solid options.
Overall, it is worth installing the Spotify desktop player as it’s far superior to the web player in both operating and looks, along with not accidentally closing your browser and losing Spotify.