如何使用 apt-offline 命令安装具有依赖项的特定包?

如何使用 apt-offline 命令安装具有依赖项的特定包?

我已经安装apt-offline在两台运行 debian jessie 的机器上,pc1(在线)和 pc2(离线)。

我正在使用以下命令:

sudo apt-key exportall |
sudo gpg --no-default-keyring --import --keyring /etc/apt/trusted.gpg

修复丢失的密钥并成功更新 pc2。问题是无法为某些包生成签名文件,例如dkms。我使用以下命令获取签名文件:

apt-offline set debian-install.sig --install-packages dkms

是否可以使用命令在 pc2 上安装特定的软件包,例如dkms和?linux-headersapt-offline

答案1

这是一个杰西容器。下面是我在常规 Debian Unstable 机器上运行的“get”操作。

rrs@learner:~$ machinectl start jessie 
2016-04-21 / 23:06:53 ♒♒♒  ☺  

rrs@learner:~$ machinectl login jessie 
Connected to machine jessie. Press ^] three times within 1s to exit session.

Debian GNU/Linux 8 learner pts/0

learner login: root
Password: 
Last login: Fri Apr 15 11:46:51 UTC 2016 on pts/0
Linux learner 4.5.0-1-amd64 #1 SMP Debian 4.5.1-1 (2016-04-14) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

root@learner:~# apt-cache policy dkms
dkms:
  Installed: (none)
  Candidate: 2.2.0.3-2
  Version table:
     2.2.0.3-2 0
        500 http://httpredir.debian.org/debian/ jessie/main amd64 Packages

root@learner:~# sudo ^C
root@learner:~# apt-offline set /var/tmp/lxc/dkms.sig --install-packages dkms

Generating database of package ['dkms'] and its dependencies.

root@learner:~# apt-offline  --version
1.7

root@learner:~# apt-offline  install /var/tmp/lxc/dkms.zip 
libasan0_4.8.4-1_amd64.deb file synced.
libasan1_4.9.2-10_amd64.deb file synced.
libatomic1_4.9.2-10_amd64.deb file synced.
libcilkrts5_4.9.2-10_amd64.deb file synced.
libisl10_0.12.2-2_amd64.deb file synced.
libcloog-isl4_0.18.2-1+b2_amd64.deb file synced.
libgomp1_4.9.2-10_amd64.deb file synced.
libitm1_4.9.2-10_amd64.deb file synced.
liblsan0_4.9.2-10_amd64.deb file synced.
libmpfr4_3.1.2-2_amd64.deb file synced.
libquadmath0_4.9.2-10_amd64.deb file synced.
libtsan0_4.9.2-10_amd64.deb file synced.
libubsan0_4.9.2-10_amd64.deb file synced.
libmpc3_1.0.2-1_amd64.deb file synced.
binutils_2.25-5_amd64.deb file synced.
cpp-4.9_4.9.2-10_amd64.deb file synced.
cpp_4%3a4.9.2-2_amd64.deb file synced.
cpp-4.8_4.8.4-1_amd64.deb file synced.
libgcc-4.9-dev_4.9.2-10_amd64.deb file synced.
gcc-4.9_4.9.2-10_amd64.deb file synced.
gcc_4%3a4.9.2-2_amd64.deb file synced.
make_4.0-8.1_amd64.deb file synced.
dkms_2.2.0.3-2_all.deb file synced.
libfakeroot_1.20.2-1_amd64.deb file synced.
fakeroot_1.20.2-1_amd64.deb file synced.
libgcc-4.8-dev_4.8.4-1_amd64.deb file synced.
gcc-4.8_4.8.4-1_amd64.deb file synced.
libc-dev-bin_2.19-18+deb8u4_amd64.deb file synced.
linux-libc-dev_3.16.7-ckt25-1_amd64.deb file synced.
libc6-dev_2.19-18+deb8u4_amd64.deb file synced.
linux-compiler-gcc-4.8-x86_3.16.7-ckt25-1_amd64.deb file synced.
linux-headers-3.16.0-4-common_3.16.7-ckt25-1_amd64.deb file synced.
linux-kbuild-3.16_3.16.7-ckt20-1_amd64.deb file synced.
linux-headers-3.16.0-4-amd64_3.16.7-ckt25-1_amd64.deb file synced.
linux-headers-amd64_3.16+63_amd64.deb file synced.
manpages-dev_3.74-1_all.deb file synced.
menu_2.1.47_amd64.deb file synced.

Debian Unstable 上的“get”操作

rrs@learner:~$ apt-offline get /var/tmp/lxc/dkms.sig --bundle /var/tmp/lxc/dkms.zip --cache-dir /var/cache/apt/archives/ 

Fetching APT Data

libasan0 copied from local cache directory /var/cache/apt/archives/.                              
libasan1 copied from local cache directory /var/cache/apt/archives/.                              
libatomic1 copied from local cache directory /var/cache/apt/archives/.                              
libcilkrts5 copied from local cache directory /var/cache/apt/archives/.                              
libisl10 copied from local cache directory /var/cache/apt/archives/.                              
libcloog-isl4 copied from local cache directory /var/cache/apt/archives/.                              
libgomp1 copied from local cache directory /var/cache/apt/archives/.                              
libitm1 copied from local cache directory /var/cache/apt/archives/.                              
liblsan0 copied from local cache directory /var/cache/apt/archives/.                              
libmpfr4 copied from local cache directory /var/cache/apt/archives/.                              
libquadmath0 copied from local cache directory /var/cache/apt/archives/.                              
libtsan0 copied from local cache directory /var/cache/apt/archives/.                              
libubsan0 copied from local cache directory /var/cache/apt/archives/.                              
Downloading libmpc3 1.0.2-1 - 38 KiB                               
libmpc3 1.0.2-1 done.                                                            
binutils copied from local cache directory /var/cache/apt/archives/.                              
cpp-4.9 copied from local cache directory /var/cache/apt/archives/.                              
cpp copied from local cache directory /var/cache/apt/archives/.                              
cpp-4.8 copied from local cache directory /var/cache/apt/archives/.                              
libgcc-4.9-dev copied from local cache directory /var/cache/apt/archives/.                              
gcc-4.9 copied from local cache directory /var/cache/apt/archives/.                              
gcc copied from local cache directory /var/cache/apt/archives/.                              
make copied from local cache directory /var/cache/apt/archives/.                              
dkms copied from local cache directory /var/cache/apt/archives/.                              
libfakeroot copied from local cache directory /var/cache/apt/archives/.                              
fakeroot copied from local cache directory /var/cache/apt/archives/.                              
libgcc-4.8-dev copied from local cache directory /var/cache/apt/archives/.                              
gcc-4.8 copied from local cache directory /var/cache/apt/archives/.                              
Downloading libc-dev-bin 2.19-18+deb8u4 - 231 KiB                               
libc-dev-bin 2.19-18+deb8u4 done.                                                            
Downloading linux-libc-dev 3.16.7-ckt25-1 - 999 KiB                               
linux-libc-dev 3.16.7-ckt25-1 done.                                                            
Downloading libc6-dev 2.19-18+deb8u4 - 1 MiB                               
libc6-dev 2.19-18+deb8u4 done.                                                            
Downloading linux-compiler-gcc-4.8-x86 3.16.7-ckt25-1 - 315 KiB                               
linux-compiler-gcc-4.8-x86 3.16.7-ckt25-1 done.                                                            
Downloading linux-headers-3.16.0-4-common 3.16.7-ckt25-1 - 4 MiB                               
linux-headers-3.16.0-4-common 3.16.7-ckt25-1 done.                                                            
Downloading linux-kbuild-3.16 3.16.7-ckt20-1 - 169 KiB                               
linux-kbuild-3.16 3.16.7-ckt20-1 done.                                                            
Downloading linux-headers-3.16.0-4-amd64 3.16.7-ckt25-1 - 440 KiB                               
linux-headers-3.16.0-4-amd64 3.16.7-ckt25-1 done.                                                            
linux-headers-amd64 copied from local cache directory /var/cache/apt/archives/.                              
manpages-dev copied from local cache directory /var/cache/apt/archives/.                              
menu copied from local cache directory /var/cache/apt/archives/.                              
 37 /  37 items: [##############################] 100.0% of 38 MiB
Downloaded data to /var/tmp/lxc/dkms.zip
2016-04-21 / 23:09:04 ♒♒♒  ☺  

现在,当您在“离线”框中进行安装时,它不会要求下载任何额外的字节。

root@learner:~# apt-get install dkms
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following extra packages will be installed:
      binutils cpp cpp-4.8 cpp-4.9 fakeroot gcc gcc-4.8 gcc-4.9 libasan0 libasan1 libatomic1
      libc-dev-bin libc6-dev libcilkrts5 libcloog-isl4 libfakeroot libgcc-4.8-dev libgcc-4.9-dev
      libgomp1 libisl10 libitm1 liblsan0 libmpc3 libmpfr4 libquadmath0 libtsan0 libubsan0
      linux-compiler-gcc-4.8-x86 linux-headers-3.16.0-4-amd64 linux-headers-3.16.0-4-common
      linux-headers-amd64 linux-kbuild-3.16 linux-libc-dev make manpages-dev menu
    Suggested packages:
      binutils-doc cpp-doc gcc-4.8-locales gcc-4.9-locales gcc-multilib autoconf automake libtool
      flex bison gdb gcc-doc gcc-4.8-multilib gcc-4.8-doc libgcc1-dbg libgomp1-dbg libitm1-dbg
      libatomic1-dbg libasan0-dbg libtsan0-dbg libquadmath0-dbg gcc-4.9-multilib gcc-4.9-doc
      libasan1-dbg liblsan0-dbg libubsan0-dbg libcilkrts5-dbg glibc-doc make-doc menu-l10n gksu
      kde-runtime ktsuss
    Recommended packages:
      linux-image
    The following NEW packages will be installed:
      binutils cpp cpp-4.8 cpp-4.9 dkms fakeroot gcc gcc-4.8 gcc-4.9 libasan0 libasan1 libatomic1
      libc-dev-bin libc6-dev libcilkrts5 libcloog-isl4 libfakeroot libgcc-4.8-dev libgcc-4.9-dev
      libgomp1 libisl10 libitm1 liblsan0 libmpc3 libmpfr4 libquadmath0 libtsan0 libubsan0
      linux-compiler-gcc-4.8-x86 linux-headers-3.16.0-4-amd64 linux-headers-3.16.0-4-common
      linux-headers-amd64 linux-kbuild-3.16 linux-libc-dev make manpages-dev menu
    0 upgraded, 37 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0 B/40.7 MB of archives.
    After this operation, 155 MB of additional disk space will be used.
    Do you want to continue? [Y/n] ^C
    root@learner:~# 

答案2

你应该能够解决这个问题。请遵循此处的文档:http://www.researchut.com/tools/apt-offline

并且您应该只使用来自 Debian Backports 的较新的 1.7 版本。我最近把它推到了那里。它解决了 Debian Jessie 的 apt-offline 中存在的许多错误。

http://www.researchut.com/blog/apt-offline-debian-jessie-backports

相关内容