我们有一个带有repo /镜像的离线网络。 但我无法弄清楚如何正确地将它添加到我的sources.list
我一直在阅读有关如何设置本地网络回购的教程。 但这不是我所拥有的 – 在我的情况下,已经有一个网络回购 – 让我们说它住在这里:
http://netpc/repos/
在文件夹结构里面看起来像(我只扩展了一点,但是有很多文件夹/子文件夹看起来都非常Ubuntu-y):
/1604/ /1604/mirror /1604/mirror/archive.ubuntu.com /1604/mirror/archive.ubuntu.com/mwg-internal /1604/mirror/archive.ubuntu.com/ubuntu /1604/skel /1604/var ...etc...
所以按照我的阅读,我想我只需要更新我的/etc/apt/sources.list
文件。 我做了备份,然后将以下内容添加到文件中:
# Adding local network repo deb http://netpc/repos ./
然后我做了以下命令:
sudo apt-get update
我得到了以下输出(手动输入cuz在不同的PC上离线):
Ign:1 http://netpc/repos/1604/ ./ InRelease Ign:2 http://netpc/repos/1604/ ./ Release Ign:3 http://netpc/repos/1604/ ./ Packges Ign:4 http://netpc/repos/1604/ ./ Translation-en_GB Ign:5 http://netpc/repos/1604/ ./ Translation-en Ign:3 http://netpc/repos/1604/ ./ Packages : : Ign:5 http://netpc/repos/1604/ ./ Translation-en Err:3 http://netpc/repos/1604/ ./ Packages 404 Not Found Ign:4 http://netpc/repos/1604/ ./ Translation-en_GB Ign:5 http://netpc/repos/1604/ ./ Translation-en : : W: the repository 'http://netpc/repos/1604 ./ Release' does not have a release file. : : E: Failed to fetch http://netpc/repos/1604/./Packages 404 Not Found
它试图连接到网络上的其他存储库(但我们没有连接到网络),所以它找不到像gb.archive.ubuntu.com这样的地方……
所以我希望我的系统忽略在线位置,只需在LAN上使用我的一个“镜像”位置。
- 为什么我的设置不起作用(我错过了什么)?
- 我需要采取哪些步骤来解决此问题并忽略其他基于互联网的位置?
UPDATE
我从两个答案中更新了sources.list – 我尝试了以下更好的结果:
# Main and restricted deb http://netpc/repos/1604/mirror/archive.ubuntu.com/ubuntu xenial main restricted deb http://netpc/repos/1604/mirror/archive.ubuntu.com/ubuntu xenial-updates main restricted deb http://netpc/repos/1604/mirror/archive.ubuntu.com/ubuntu xenial-security main restricted deb-src http://netpc/repos/1604/mirror/archive.ubuntu.com/ubuntu xenial main restricted deb-src http://netpc/repos/1604/mirror/archive.ubuntu.com/ubuntu xenial-updates main restricted deb-src http://netpc/repos/1604/mirror/archive.ubuntu.com/ubuntu xenial-security main restricted # Universe : # Multiverse :
并重新运行sudo apt-get update
所以我不能输出所有输出,但我把主要错误放在过程的最后:
E: Failed to fetch http://netpc/repos/1604/mirror/archive.ubuntu.com/ubuntu/dists/xenial/main/binary-i386/Packages 404 Not Found E: Failed to fetch http://netpc/repos/1604/mirror/archive.ubuntu.com/ubuntu/dists/xenial-updates/main/binary-i386/Packages 404 Not Found E: Failed to fetch http://netpc/repos/1604/mirror/archive.ubuntu.com/ubuntu/dists/xenial-security/main/binary-i386/Packages 404 Not Found
所以看起来它找不到i386的东西(32位),我不确定我在乎,因为我使用的是64位……我想……
我不是专家,但我已经建立了自己的本地镜像并让它工作。
我对你添加到sources.list的行中的./
怀疑。 我看起来像这样:
# updated for local mirror on 2/11/18 # local main & restricted sources deb ssh://my-server/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu/ bionic main restricted deb ssh://my-server/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted deb ssh://my-server/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu/ bionic-security main restricted # local universe sources deb ssh://my-server/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu/ bionic universe deb ssh://my-server/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu/ bionic-updates universe deb ssh://my-server/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu/ bionic-security universe # local multiverse sources deb ssh://my-server/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu/ bionic multiverse deb ssh://my-server/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse deb ssh://my-server/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu/ bionic-security multiverse
我使用ssh而不是http,但这并不是我想指出的区别。
我认为您需要编辑sources.list并在URL后添加正确的文本。
仅添加LAN存储库的基本URL是不够的。 您需要指向存储库结构的相关部分,包括您正在使用的Ubuntu版本(按版本名称)。
替换源文件的每一行中的基本URL,但保留该行的其余信息。
如果你使用14.04,Trusty Tahr,你的/etc/apt/sources.list
文件看起来像这样:
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://gb.archive.ubuntu.com/ubuntu trusty main restricted deb-src http://gb.archive.ubuntu.com/ubuntu trusty main restricted ...
您更新的文件应该更像:
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://netpc/repos/1604/mirror/archive.ubuntu.com/ubuntu trusty main restricted deb-src http://netpc/repos/1604/mirror/archive.ubuntu.com/ubuntu trusty main restricted ...