第一步安装apt-offline
apt-offline-1.8.6.zip

cd apt-offline-1.8.6
sudo python setup.py install  //离线编译安装apt-offline，python不完整


// 查看依赖
sudo apt-cache depends apt-offline
// 下载依赖
sudo apt-get download apt-offline python3-magic






// 分为三类命令 set 离线电脑生成，get在线电脑生成，install反过来给离线电脑下载。
usage: apt-offline [-h] [--verbose] [--quiet] [-v] {set,get,install} ...
// 核心是set命令，标明要安装什么文件
alientek@alientek-virtual-machine:~$ apt-offline set --help
usage: apt-offline set [-h] [--verbose] [--quiet] [--simulate] [--install-packages [PKG [PKG ...]]]
                       [--install-src-packages [SOURCE PKG [SOURCE PKG ...]]] [--src-build-dep] [--release release_name] [--update]
                       [--upgrade] [--upgrade-type upgrade] [--generate-changelog] [--apt-backend apt-get]
                       apt-offline.sig

positional arguments:
  apt-offline.sig       Generate a signature file

optional arguments:
  -h, --help            show this help message and exit
  --verbose             Enable verbose messages
  --quiet               Enable quiet mode
  --simulate            Just simulate. Very helpful when debugging
  --install-packages [PKG [PKG ...]]
                        Packages that need to be installed
  --install-src-packages [SOURCE PKG [SOURCE PKG ...]]
                        Source Packages that need to be installed
  --src-build-dep       Install Build Dependency packages for requested source packages
  --release release_name
                        Release target to install packages from
  --update              Generate Signature to update APT Database
  --upgrade             Generate Signature of packages to be upgraded
  --upgrade-type upgrade
                        Type of upgrade to do. Use one of upgrade, dist-upgrade, dselect-ugprade
  --generate-changelog  Generate changelog of the version to be downloaded
  --apt-backend apt-get
                        APT backend to use. One of: apt, apt-get, python-apt


// get 命令从 上网电脑安装
alientek@alientek-virtual-machine:~$ apt-offline get --help
usage: apt-offline get [-h] [--verbose] [--quiet] [--socket-timeout 30]
                       [-d apt-downloads] [-s /var/cache/apt/archives/]
                       [--no-checksum] [-t 1]
                       [--bundle apt-offline-bundle.zip] [--bug-reports]
                       [--proxy-host PROXY_HOST] [--proxy-port PROXY_PORT]
                       [--https-cert-file HTTPS_CERT_FILE]
                       [--https-key-file HTTPS_KEY_FILE]
                       [--http-basicauth https://username:password@hostname.com/]
                       [--disable-cert-check]
                       apt-offline.sig

positional arguments:
  apt-offline.sig       Get apt-offline data

optional arguments:
  -h, --help            show this help message and exit
  --verbose             Enable verbose messages
  --quiet               Enable quiet mode
  --socket-timeout 30   Set Socket Timeout
  -d apt-downloads, --download-dir apt-downloads
                        Folder path to save files to
  -s /var/cache/apt/archives/, --cache-dir /var/cache/apt/archives/
                        Cache folder to search for
  --no-checksum         Do not validate checksum of downloaded files
  -t 1, --threads 1     Number of threads to spawn
  --bundle apt-offline-bundle.zip
                        Bundle output data to a file
  --bug-reports         Fetch bug reports from the BTS
  --proxy-host PROXY_HOST
                        Proxy Host to use
  --proxy-port PROXY_PORT
                        Proxy port number to use
  --https-cert-file HTTPS_CERT_FILE
                        Certificate file for https client authentication
  --https-key-file HTTPS_KEY_FILE
                        Certificate key for https client authentication
  --http-basicauth https://username:password@hostname.com/
                        A user/password encoded URL. Passwords with special
                        characters should be percent encoded
  --disable-cert-check  Disable Certificate check on https connections

// install
alientek@alientek-virtual-machine:~$ apt-offline install --help
usage: apt-offline install [-h] [--verbose] [--quiet] [--simulate] [--install-src-path INSTALL_SRC_PATH]
                           [--extra-keyring /etc/apt/keyring/] [--skip-bug-reports] [--skip-changelog] [--allow-unauthenticated]
                           [--strict-deb-check]
                           apt-offline-download.zip | apt-offline-download/

positional arguments:
  apt-offline-download.zip | apt-offline-download/
                        Install apt-offline data, a bundle file or a directory

optional arguments:
  -h, --help            show this help message and exit
  --verbose             Enable verbose messages
  --quiet               Enable quiet mode
  --simulate            Just simulate. Very helpful when debugging
  --install-src-path INSTALL_SRC_PATH
                        Install src packages to specified path.
  --extra-keyring /etc/apt/keyring/
                        Extra Keyring path to include for.
  --skip-bug-reports    Skip the bug report check
  --skip-changelog      Skip display of changelog
  --allow-unauthenticated
                        Ignore apt gpg signatures mismatch
  --strict-deb-check    Perform strict checksum validaton for downloaded .deb files


[Apt-offline离线安装指南](https://zhuanlan.zhihu.com/p/583446570)


// 完整流程
apt-offline set --install-packages vim git xxx.sig
apt-offline get xxx.sig --bundle result.zip
apt-offline install result.zip


// 完整教程
https://github.com/rickysarraf/apt-offline
make build
make install
make clean