Skip to content

Instantly share code, notes, and snippets.

@jjjhong91
Forked from ycku/apt-offline.md
Last active August 17, 2020 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjjhong91/7303402bc6506a7efe66fde91fa14500 to your computer and use it in GitHub Desktop.
Save jjjhong91/7303402bc6506a7efe66fde91fa14500 to your computer and use it in GitHub Desktop.
記錄 apt-offline 的標準語法,在離線環境使用 apt

Advantages

  1. 相容原有的 source list
  2. 只下載需要安裝的套件
  3. 步驟單純

Goals

基本上就是處理下面三種(apt update, upgrade, install)需要網路的操作

  • online$: 表示在有對外網路的主機操作
  • offline$: 表示在無對外網路的主機操作
  • 如何把檔案存放到你的 offline 主機,因環境各異,請自行處理
  • 會依 offline 主機的 source list 取得更新,與 online 主機的設定無關

Install apt-offline

online$ sudo apt-get install apt-offline
offline$ sudo dpkg -i apt-offline_1.8.1_all.deb

apt update

offline$ sudo apt-offline set --update update.sig
online$ apt-offline get update.sig --threads 5 --bundle update.zip
offline$ sudo apt-offline install update.zip
  • 檔名可自由取名

apt upgrade

offline$ sudo apt-offline set --upgrade upgrade.sig
online$ apt-offline get upgrade.sig --threads 5 --bundle upgrade.zip
offline$ sudo apt-offline install upgrade.zip
offline$ sudo apt-get upgrade
  • 檔名可自由取名
  • 不能使用 apt,要用 apt-get

apt install

offline$ sudo apt-offline set install.sig --install-packages apache2 libapache2-mod-php
online$ apt-offline get install.sig --threads 5 --bundle install.zip
offline$ sudo apt-offline install install.zip
offline$ sudo apt-get install apache2 libapache2-mod-php
  • 檔名可自由取名
  • 不能使用 apt,要用 apt-get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment