我目前正在尝试离线安装软件(研究这个问题)并想根据这个答案使用离线存储库。
我按照以下步骤操作:
- 把所有债务都放进去
/var/my-local-repo
sudo bash -c 'dpkg-scanpackages /var/my-local-repo /dev/null > /var/my-local-repo/Packages'
(注意:dpkg-dev
已安装以执行此操作)echo "deb file:/var/my-local-repo ./" > /etc/apt/sources.list.d/my-local.list
通过和将存储库设置为 rootsudo apt-get update
但是当我尝试安装包时,显示以下错误:
以下是安装时终端的示例输出synaptic
:
$ sudo apt-get install synaptic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
docbook-xml libcairo-perl libept1.4.12 libglib-perl libgtk2-perl
libpango-perl librarian0 rarian-compat sgml-data
Suggested packages:
docbook docbook-dsssl docbook-xsl docbook-defguide libfont-freetype-perl
libgtk2-perl-doc perlsgml w3-recs opensp libxml2-utils dwww menu deborphan
tasksel
The following NEW packages will be installed:
docbook-xml libcairo-perl libept1.4.12 libglib-perl libgtk2-perl
libpango-perl librarian0 rarian-compat sgml-data synaptic
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/3,437 kB of archives.
After this operation, 17.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
WARNING: The following packages cannot be authenticated!
libept1.4.12 sgml-data docbook-xml libcairo-perl libglib-perl libpango-perl
libgtk2-perl synaptic librarian0 rarian-compat
Install these packages without verification? [y/N] Y
Err file:/var/my-local-repo/ ./ libept1.4.12 1.0.12
File not found
Err file:/var/my-local-repo/ ./ sgml-data 2.0.9-1
File not found
Err file:/var/my-local-repo/ ./ docbook-xml 4.5-7.2
File not found
Err file:/var/my-local-repo/ ./ libcairo-perl 1.104-1
File not found
Err file:/var/my-local-repo/ ./ libglib-perl 3:1.304-1
File not found
Err file:/var/my-local-repo/ ./ libpango-perl 1.224-2
File not found
Err file:/var/my-local-repo/ ./ libgtk2-perl 2:1.249-2
File not found
Err file:/var/my-local-repo/ ./ synaptic 0.81.1
File not found
Err file:/var/my-local-repo/ ./ librarian0 0.8.1-5ubuntu1
File not found
Err file:/var/my-local-repo/ ./ rarian-compat 0.8.1-5ubuntu1
File not found
E: Failed to fetch file:/var/my-local-repo//var/my-local-repo/libept1.4.12_1.0.12_i386.deb File not found
E: Failed to fetch file:/var/my-local-repo//var/my-local-repo/sgml-data_2.0.9-1_all.deb File not found
E: Failed to fetch file:/var/my-local-repo//var/my-local-repo/docbook-xml_4.5-7.2_all.deb File not found
E: Failed to fetch file:/var/my-local-repo//var/my-local-repo/libcairo-perl_1.104-1_i386.deb File not found
E: Failed to fetch file:/var/my-local-repo//var/my-local-repo/libglib-perl_3%3a1.304-1_i386.deb File not found
E: Failed to fetch file:/var/my-local-repo//var/my-local-repo/libpango-perl_1.224-2_i386.deb File not found
E: Failed to fetch file:/var/my-local-repo//var/my-local-repo/libgtk2-perl_2%3a1.249-2_i386.deb File not found
E: Failed to fetch file:/var/my-local-repo//var/my-local-repo/synaptic_0.81.1_i386.deb File not found
E: Failed to fetch file:/var/my-local-repo//var/my-local-repo/librarian0_0.8.1-5ubuntu1_i386.deb File not found
E: Failed to fetch file:/var/my-local-repo//var/my-local-repo/rarian-compat_0.8.1-5ubuntu1_i386.deb File not found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
在这里我们可以看到apt 尝试从而/var/my-local-repo//var/my-local-repo/
不是var/my-local-repo/
如果我将所有 deb 移动到/var/my-local-repo/var/my-local-repo/
(通过创建子目录),那么在 apt 工作正常并安装包之后!
突触工作正常。
所以,我的问题是为什么 Apt 从错误的位置获取 debs 或/和需要什么更正echo "deb file:/var/my-local-repo ./"
?
1 到 2 天后我自己找到了解决方案/更正并且需要更正,其工作方式如下:
如何
Packages.gz
创建dpkg-scanpackages
?方式一:-
如果
Packages.gz
文件是通过以下命令创建的:然后它具有如下所有 debs 位置信息:
方式 2(推荐):-
如果
Packages.gz
文件是通过以下命令创建的:(换句话说,在更改到包含所有 debs 的目录之后)
然后它具有如下所有 debs 位置信息:
现在,如果
Packages.gz
是由 Way-1 创建的,那么存储库 .list 中需要的更正是:deb file:/// var/my-local-repo/
或者deb file:// /var/my-local-repo/
但建议使用
Packages.gz
Way-2 创建,无需更正,.list 中的正确存储库为:deb file:///var/my-local-repo/ ./
或者deb file:/var/my-local-repo/ ./
早些时候我
Packages.gz
由 Way-1 创建并为第二种方式设置存储库,这就是为什么apt
尝试从不需要的目录中获取 debs 的原因。Packages.gz
但现在我明白了原因并使用第二种方式创建dpkg-scanpackages
和最终命令是:用于生成
Packages.gz
:对于设置存储库:
然后包安装成功如下: