LoginSignup
1
1

More than 3 years have passed since last update.

オフライン環境でalpineのapkインストールを行う

Posted at

概要

ネットワークにアクセスできない環境などでローカルパッケージを使ってapkのインストールを行う方法です。
alpineのバージョンは3.11.5で確認しています。

パッケージのダウンロード

まずネットワークの使える環境でパッケージのダウンロードを行います。
Rオプションを指定して依存するパッケージごとまとめてダウンロードします。

# apk fetch -R curl
Downloading libcrypto1.1-1.1.1d-r3
Downloading curl-7.67.0-r0
Downloading busybox-1.31.1-r9
Downloading ca-certificates-20191127-r1
Downloading libssl1.1-1.1.1d-r3
Downloading libcurl-7.67.0-r0
Downloading nghttp2-libs-1.40.0-r0
Downloading musl-1.1.24-r2
Downloading zlib-1.2.11-r3

# ls
busybox-1.31.1-r9.apk            curl-7.67.0-r0.apk               libcurl-7.67.0-r0.apk            musl-1.1.24-r2.apk               zlib-1.2.11-r3.apk
ca-certificates-20191127-r1.apk  libcrypto1.1-1.1.1d-r3.apk       libssl1.1-1.1.1d-r3.apk          nghttp2-libs-1.40.0-r0.apk

パッケージのインストール

インストールを行いたい環境で以下のコマンドを実行します。
パッケージは適宜必要なものを指定してください。

# apk add --allow-untrusted --no-network --repositories-file=repo.list *.apk
(1/4) Installing ca-certificates (20191127-r1)
(2/4) Installing nghttp2-libs (1.40.0-r0)
(3/4) Installing libcurl (7.67.0-r0)
(4/4) Installing curl (7.67.0-r0)
Executing busybox-1.31.1-r9.trigger
Executing ca-certificates-20191127-r1.trigger
OK: 7 MiB in 18 packages

1
1
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
1
1