Linux 如何使 Debian 软件包安装依赖项?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8477036/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make Debian package install dependencies?
提问by Nuno Santos
I want to make a simple Debian package to install a simple tool that depends on Qt4 libs.
我想制作一个简单的 Debian 包来安装一个依赖 Qt4 库的简单工具。
In control file I have defined that it depends on Qt4 libs however, by the time I'm testing the package it says that the dependency could not be met.
在控制文件中,我已经定义它依赖于 Qt4 库,但是当我测试包时,它说无法满足依赖关系。
Question:
题:
How can I make Debian trigger apt to install the dependencies as well?
我怎样才能让 Debian 触发 apt 来安装依赖项?
Can't find that the documentation however I know that apt-get does that.
找不到文档,但是我知道 apt-get 可以做到这一点。
回答by Jonathan
One way would be to create a local package repository on your computer and add it to /etc/apt/sources.list. Then you could install the package from your local repository with apt-get and have the dependencies resolved automatically.
一种方法是在您的计算机上创建一个本地包存储库并将其添加到 /etc/apt/sources.list。然后,您可以使用 apt-get 从本地存储库安装软件包,并自动解析依赖项。
There's probably an easier way to do it, but I don't know what that would be.
可能有一种更简单的方法来做到这一点,但我不知道那会是什么。
回答by Carlos Campderrós
If you install it via dpkg
it won't work because dkpg
doesn't know where to find additional dependencies. You could do it via apt-get
if you build your own repo, but it's kind of time-consuming the first time (it's not difficult, just something "new" the first time that needs some time to be learnt).
如果您通过dpkg
它安装它将无法工作,因为dkpg
不知道在哪里可以找到其他依赖项。apt-get
如果您构建自己的存储库,您可以通过它来完成,但是第一次有点耗时(这并不难,只是第一次需要一些时间来学习“新”的东西)。
On the other hand, and the solution you are probably looking for is gdebi
(you may need to install it: apt-get install gdebi-core
). It's a tool that checks the dependencies for a package and calls apt-get
to fetch and install them, and then calls dpkg
to install your package.
另一方面,您可能正在寻找的解决方案是gdebi
(您可能需要安装它:)apt-get install gdebi-core
。它是一个工具,用于检查包的依赖关系并调用apt-get
获取和安装它们,然后调用dpkg
以安装您的包。
回答by BRPocock
If you're creatingthe Debian package, you specify its dependencies in the debian/
directory control files; I believe debian/control
takes Depends:
directives for that purpose.
如果您正在创建Debian 软件包,请在debian/
目录控制文件中指定其依赖项;我相信为此目的debian/control
采取Depends:
指令。
I don't know the details too clearly, myself, but there are instructions at http://www.debian.org/doc/manuals/maint-guide/; in particular, http://www.debian.org/doc/manuals/maint-guide/dreq.en.html#controlseems to be the right place to start looking.
我自己也不太清楚细节,但在http://www.debian.org/doc/manuals/maint-guide/上有说明;特别是,http://www.debian.org/doc/manuals/maint-guide/dreq.en.html#control似乎是开始寻找的正确位置。
回答by Thomas Leonard
回答by sampablokuper
Per @textshellin this answer:
starting with apt 1.1 (available in Xenial (16.04), stretch)
apt install
also allows local files:sudo apt install ./foo-1.2.3.deb
So much simpler and cleaner.
See the release announcment
从 apt 1.1(在 Xenial (16.04)、stretch 中可用)开始
apt install
也允许本地文件:sudo apt install ./foo-1.2.3.deb
如此简单和干净。
见发布公告
This will also install dependencies, just like a normal apt install
or apt-get install
.
这也将安装依赖项,就像普通apt install
或apt-get install
.