Ubuntu 安裝 Spotify 的方法

本篇紀錄 Ubuntu 下 安裝 Spotify 的方法,

我的使用環境為 Ubuntu 16.04,也適用於 Ubuntu 18.04 跟 Ubuntu 20.04。

Ubuntu 安裝 Spotify

這邊會介紹怎麼使用 apt-get 安裝 Spotify,在使用 apt-get 安裝 Spotify 之前要先設定 Spotify 的 ubuntu/debian 倉儲 (repository)

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

加入 repository.spotify.com 到 apt sources list,這樣以後 apt-get update 就會去檢查有無更新,

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

然後 apt-get update 成功後就可以安裝 spotify-client

1
2
sudo apt-get update
sudo apt-get install spotify-client

安裝 spotify-client 後檢查一下安裝的版本(這步驟非必要),

1
2
$ dpkg -l | grep spotify-client
ii spotify-client 1:1.0.80.480.g51b03ac3-13 amd64 Spotify streaming music client

現在 spotify-client 最新的版本是 1:1.1.84.716.gc5f8b819,但我還沒更新到最新。

也可以參考 Spotify 官方的 linux 安裝教學

錯誤排除

如果已經有安裝 Spotify 的人,後來很久後遇到 apt-get update 時會顯示 repository.spotify.com 站點憑證簽署問題而導致 apt-get update 失敗的話,可以參考這個方法,

apt-get update 失敗的訊息如下,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sudo apt-get update
...
Hit:10 http://repo.steampowered.com/steam precise InRelease
Err:8 http://repository.spotify.com stable InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5E3C45D7B312C643
Hit:11 http://ppa.launchpad.net/mystic-mirage/pycharm/ubuntu xenial InRelease
Hit:12 http://ppa.launchpad.net/openshot.developers/ppa/ubuntu xenial InRelease
Get:13 https://download.01.org/gfx/ubuntu/16.04/main xenial InRelease [3,651 B]
Hit:14 http://ppa.launchpad.net/peek-developers/stable/ubuntu xenial InRelease
Hit:15 http://ppa.launchpad.net/rvm/smplayer/ubuntu xenial InRelease
Hit:16 http://ppa.launchpad.net/umang/indicator-stickynotes/ubuntu xenial InRelease
Fetched 6,967 B in 3s (2,040 B/s)
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://repository.spotify.com stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5E3C45D7B312C643
W: https://download.01.org/gfx/ubuntu/16.04/main/dists/xenial/InRelease: Signature by key 09D6EF97BFB38E916EF060E756A3DEF863961D39 uses weak digest algorithm (SHA1)
W: Failed to fetch http://repository.spotify.com/dists/stable/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5E3C45D7B312C643
W: Some index files failed to download. They have been ignored, or old ones used instead.

解決方法,就是把上面的訊息提到的 5E3C45D7B312C643 PUBKEY 加入,

1
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 5E3C45D7B312C643

然後再 apt-get update 就可以成功了

其他參考
Can’t install Spotify under Ubuntu. - The Spotify Community
https://community.spotify.com/t5/Desktop-Linux/Can-t-install-Spotify-under-Ubuntu/td-p/5258438
下方網友 carlgarner 2022-02-22 02:56 PM 回覆目前的 key 是 5E3C45D7B312C643,而我今天 2022-05-31 測試還有效,根據過往經驗可能隔一陣子就會失效。

相關文章
Ubuntu 安裝 protobuf
Ubuntu 安裝 gflags
Ubuntu 安裝 libevent
Ubuntu 編譯安裝 GLFW