如何使用 apt 在 Ubuntu 20.04 上安装 iptables-dev?

如何使用 apt 在 Ubuntu 20.04 上安装 iptables-dev?

我尝试了以下操作:

sudo apt install iptables-dev

但出现此错误

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package iptables-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  libxtables-dev libip6tc-dev libip4tc-dev

E: Package 'iptables-dev' has no installation candidate

我知道 iptables 已被弃用,但我需要这个包,因为我正在尝试运行需要它的以下命令:

# sudo apt-get build-dep strongswan
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 builddeps:strongswan : Depends: iptables-dev but it is not installable
E: Unable to correct problems, you have held broken packages.

这不再是一个选项了吗?我必须从源代码进行编译吗?

答案1

我找到了解决办法。我部署了一个单独的 Ubuntu 18.04 VM。然后我做了

sudo apt download iptables-dev

这给了我iptables-dev_1.6.1-2ubuntu2_amd64.deb。然后我将文件复制到 20.04 服务器,并安装

sudo dpkg -i iptables-dev_1.6.1-2ubuntu2_amd64.deb

相关内容