LoginSignup
14
9

More than 3 years have passed since last update.

RaspbianにUbuntu用のPPAを追加する

Last updated at Posted at 2018-08-11

RaspbianでUbuntu用のPersonal Package Archives (PPA) を使う場合の手順を紹介します。

Ubuntu環境ならadd-apt-repositoryを使えばリポジトリの追加ができるはずですが、Raspbian環境では下記のようなエラーが出てリポジトリの追加に失敗します。

$ sudo add-apt-repository ppa:chromium-team/beta
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 95, in <module>
    sp = SoftwareProperties(options=options)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__
    self.reload_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist
    self.distro.get_sources(self.sourceslist)
  File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_sources
    (self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/stretch

Raspbian用のリポジトリではないので怒られているみたいですね。

このような場合でも、 /etc/apt/sources.list.d/ を直接書き換えればUbuntu用のARMバイナリを apt install 一発でインストールできるようになります。

インストール手順

今回はChromium beta をapt管理の対象にしてみましょう。

$ sudo apt install dirmngr
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB69B232436DAC4B50BDC59E4E1B983C5B393194

まず公開鍵の登録をします。上記2コマンド目の最後の引数はPPAページの「Technical details about this PPA」を開いて「Signing key:」のスラッシュ以降の値を使います。

image.png

次にリポジトリのURLを設定します。

$ sudo vi /etc/apt/sources.list.d/chromium-beta.list
/etc/apt/sources.list.d/chromium-beta.list
deb http://ppa.launchpad.net/chromium-team/beta/ubuntu xenial main
deb-src http://ppa.launchpad.net/chromium-team/beta/ubuntu xenial main

現在最新版のRaspbianはDebian9.4ベースですので、対応するバージョンであるUbuntu 16.04 (Xenial) 用のバイナリを利用する設定にします1

これで新しいバージョンのchromium-browserが利用できるはずです。さっそくインストールしてみましょう。

$ sudo apt update
ヒット:1 http://archive.raspberrypi.org/debian stretch InRelease
取得:2 http://ppa.launchpad.net/chromium-team/beta/ubuntu xenial InRelease [24.3 kB]
取得:3 http://raspbian.raspberrypi.org/raspbian stretch InRelease [15.0 kB]
取得:4 http://ppa.launchpad.net/chromium-team/beta/ubuntu xenial/main Sources [1,100 B]
取得:5 http://ppa.launchpad.net/chromium-team/beta/ubuntu xenial/main armhf Packages [1,584 B]
取得:6 http://ppa.launchpad.net/chromium-team/beta/ubuntu xenial/main Translation-en [1,072 B]
43.0 kB を 4秒 で取得しました (9,280 B/s)
パッケージリストを読み込んでいます... 完了
$ sudo apt upgrade chromium-browser
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
アップグレードパッケージを検出しています... 完了
以下のパッケージは保留されます:
  sense-emu-tools
以下のパッケージはアップグレードされます:
  ca-certificates chromium-browser chromium-browser-l10n chromium-codecs-ffmpeg-extra dpkg dpkg-dev file fuse libavcodec57 libavfilter6 libavformat57 libavresample3 libavutil55 libcups2 libcupsimage2 libdpkg-perl libexiv2-14
  libfaad2 libfuse2 libgs9 libgs9-common libmagic-mgc libmagic1 libpam-systemd libpostproc54 libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0 libsoup-gnome2.4-1 libsoup2.4-1 libswresample2 libswscale4
  libsystemd0 libudev1 lxplug-network lxplug-ptbatt patch piclone pipanel python-pantilthat python-sense-emu python-sense-emu-doc python3-pantilthat python3-sense-emu raspberrypi-bootloader raspberrypi-kernel raspberrypi-ui-mods
  rc-gui realvnc-vnc-server rp-prefapps rpi-chromium-mods shared-mime-info systemd systemd-sysv tzdata udev wolfram-engine wolframscript
アップグレード: 59 個、新規インストール: 0 個、削除: 0 個、保留: 1 個。
471 MB のアーカイブを取得する必要があります。
(略)
done.

無事インストールできました。

$ chromium-browser --version
Chromium 69.0.3497.32 Built on Ubuntu , running on Raspbian 9.4

上記の通りバッチリ動作しています。やりましたね。

注意点

この方法が使えるかどうかは、Raspberry PiのCPUに依存します。Debian/UbuntuのarmhfパッケージはARMv7アーキテクチャ向けにコンパイルされているので、ARMv6であるRaspberry Pi 1およびZeroでは動きません。Raspberry Pi 2以降なら動作するはずです。(参考資料:Raspberry Pi - Wikipedia

14
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
9