How to Install Spotify on Ubuntu 20.04

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 Ubuntu 20.04 LTS Focal Fossa desktop using three different methods.

Prerequisites

  • Recommended OS: Ubuntu 20.04 or higher
  • User account: A user account with sudo or root access.

Update Operating System

Update your Ubuntu operating system to make sure all existing packages are up to date:

sudo apt update && sudo apt upgrade -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@ubuntu ~]$ sudo whoami
root

To set up an existing or new sudo account, visit our tutorial on How to Add a User to Sudoers on Ubuntu.

To use the root account, use the following command with the root password to log in.

su

The tutorial will be utilizing the terminal, and for those unfamiliar, this can be found in your show applications menu.

Example:

How to Install Spotify on Ubuntu 20.04
Advertisement

Option 1 – Install Spotify with APT

The first installation option is to import the repository from Spotify and install it using the APT package manager. This would be the ideal solution for most users, especially when keeping the package up to date.

First, install the following dependencies needed to install Spotify using the APT method.

sudo apt install curl libcanberra-gtk-module -y

Secondly, to import the repository in your terminal, use the following command.

echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list

The above command will automatically add the Spotify repository to your Ubuntu APT directory with its unique listing.

Next, use the following command to import the GPG key to allow the system to trust the packages being added from the repository.

curl -sS https://download.spotify.com/debian/pubkey_0D811D58.gpg | sudo apt-key add -

Example output:

OK

Next, update your system to reflect the new addition.

sudo apt update

With the repository sorted, proceed to install Spotify using the following.

sudo apt install spotify-client

Example output:

How to Install Spotify on Ubuntu 20.04

Verify the installation by using the apt-cache policy command.

apt-cache policy spotify-client

Example output:

How to Install Spotify on Ubuntu 20.04

Spotify updates are handled using the standard apt update & upgrade command.

sudo apt update
sudo apt upgrade

If you no longer wish to have Spotify installed with the APT method, use the following command to remove the package.

sudo apt autoremove spotify-client --purge

This will automatically remove any unused dependencies that were installed originally with Spotify.

Additionally, remove the repository source listing with the following command.

sudo rm /etc/apt/sources.list.d/spotify.list

Option 2 – Install Spotify with Flatpak

The second option is to use the Flatpak package manager. Flatpak is not installed on Ubuntu 20.04 by default, but it is available in its repository.

First, install the Flatpak package.

sudo apt install flatpak -y

Next, you need to enable Flatpack for Ubuntu using the following command in your terminal:

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

Note the message. This will be covered later on.

are not in the search path set by the XDG_DATA_DIRS environment variable, so
applications installed by Flatpak may not appear on your desktop until the
session is restarted.

Now install Spotify using the following flatpak command.

flatpak install flathub com.spotify.Client

Example output:

How to Install Spotify on Ubuntu 20.04

Type Y twice, then press the ENTER KEY twice to proceed with the installation.

YOU MUST RESTART YOUR PC IF THE ICON IS MISSING OR THE APP IS NOT LAUNCHING FOR THE FIRST TIME!

You can log in and out of your session to view the application icon or use the following terminal command.

sudo reboot

Note, if your icon is not missing and your app launches, then ignore the above command.

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:

How to Install Spotify on Ubuntu 20.04

Type Y and then ENTER KEY to proceed with the removal of Spotify using the Flatpak method.

Advertisement

Option 3 – Install Spotify with Snapcraft

The third option is to use the Snap package manager. By default, Snap should be installed on any Ubuntu-supported distribution.

If you have re-removed Snap, re-install Snap, use the following command:

sudo apt install snapd -y

When you have returned to your system, start the snapd service and enable automatic startup.

sudo systemctl enable snapd --now

Next, some packages come in classic, so you need to create a symlink to enable classic snap support.

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

If you are installing Snap for the first time, it is advised to install the core files to avoid conflicting issues:

sudo snap install core

Example output:

core 16-2.52.1 from Canonical✓ installed

Next, it is recommended to restart the snap service at this point.

sudo systemctl restart spotify

Next, verify the Snapd service is running by using the systemctl command:

systemctl status snapd

Example:

How to Install Spotify on Ubuntu 20.04

Next, install the Spotify package using snap:

sudo snap install spotify

Example output:

spotify 1.1.68.632.g2b11de83 from Spotify✓ installed

As above, this informs you that Spotify was successfully installed and the version number.

YOU MUST RESTART YOUR PC IF THE ICON IS MISSING OR THE APP IS NOT LAUNCHING FOR THE FIRST TIME! 

You can log in and out of your session to view the application icon or use the following terminal command.

sudo reboot

Note, if your icon is not missing and your app launches, then ignore the above command.

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 to have Spotify installed, remove it using the Snap remove command.

sudo snap remove spotify

Example output:

spotify removed

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:

How to Install Spotify on Ubuntu 20.04

Once you open Spotify, you will see the first default landing screen. From here, you can sign or create an account.

Example:

How to Install Spotify on Ubuntu 20.04

Congratulations, you have successfully installed and launched Spotify.

Advertisement

Comments and Conclusion

In the tutorial, you have learned how to install Spotify on your Ubuntu 20.04 LTS desktop 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 APT, 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.

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x