适用于 Linux 笔记本电脑的多个 Repos

适用于 Linux 笔记本电脑的多个 Repos

我正在开展一个项目,以便更好地管理 Linux(Ubuntu)笔记本电脑上的更新。目前,我们已经有一个适用于台式机的解决方案。

对于我们的台式机,它们配置为指向我们网络上的本地存储库以获取更新和新软件包。这很好,因为它们永远不会离开我们的内部网络。

但是,我们正在探索使用笔记本电脑同时配置本地存储库和标准 Ubuntu 存储库的想法。这个想法是,用户可以在现场从我们的本地存储库安装软件和更新,而在家时使用标准 Ubuntu(互联网)存储库。

实际上,我通过向 /etc/apt/sources.list.d/ 目录添加 2 个源来测试这一点:00-local-repo.list 和 50-ubuntu-default.list 由于两个 repos 都包含相同的软件包(以及这些软件包的版本),如果我理解正确的话,apt 应该更喜欢本地 repo(假设 apt 按字母数字顺序搜索源目录)。

问题是,当设备没有连接到我们的网络时,它不会回退到使用互联网存储库。它只会抛出一个错误:

$ sudo apt install vim
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libfprint-2-tod1 libllvm10
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  ctags vim-doc vim-scripts
The following NEW packages will be installed
  vim
0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade.
Need to get 1,238 kB of archives.
After this operation, 3,111 kB of additional disk space will be used.
Get:1 http://local-repo.example.com/ubuntu focal/main amd64 vim amd64 2:8.1.2269-1ubuntu5 [1,238 kB]
Err:1 http://local-repo.example.com/ubuntu focal/main amd64 vim amd64 2:8.1.2269-1ubuntu5
  Hash Sum mismatch
  Hashes of expected file:
   - SHA256:1e38f267bf4c06e424b166e8d666ffd6ce25c657012892d099651bee18a2c834
   - SHA1:796c962d044f99a81b187211e6ce9a0a44b8d5d1 [weak]
   - MD5Sum:198ccbb07a9fc8ebe67a213eab6a3e96 [weak]
   - Filesize:1237624 [weak]
  Hashes of received file:
   - SHA256:970310343d0d5b0f40363e17367cbd8a3dbeb809149b31850bc790f1df307b13
   - SHA1:38aca684355969d0e9d826831459568296560757 [weak]
   - MD5Sum:63c787e1b487e72a7aee2a4ac9c86f9e [weak]
   - Filesize:1032 [weak]
  Last modification reported: Fri, 21 May 2021 12:43:28 +0000
Fetched 1,032 B in 0s (8,474 B/s)
E: Failed to fetch http://local-repo.example.com/ubuntu/pool/main/v/vim/vim_8.1.2269-1ubuntu5_amd64.deb  Hash Sum mismatch
   Hashes of expected file:
    - SHA256:1e38f267bf4c06e424b166e8d666ffd6ce25c657012892d099651bee18a2c834
    - SHA1:796c962d044f99a81b187211e6ce9a0a44b8d5d1 [weak]
    - MD5Sum:198ccbb07a9fc8ebe67a213eab6a3e96 [weak]
    - Filesize:1237624 [weak]
   Hashes of received file:
    - SHA256:970310343d0d5b0f40363e17367cbd8a3dbeb809149b31850bc790f1df307b13
    - SHA1:38aca684355969d0e9d826831459568296560757 [weak]
    - MD5Sum:63c787e1b487e72a7aee2a4ac9c86f9e [weak]
    - Filesize:1032 [weak]
   Last modification reported: Fri, 21 May 2021 12:43:28 +0000
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

我的问题是,是否可以配置两个存储库并根据当前可用的版本从每个存储库安装包?

相关内容