AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1161009
Accepted
Alexander Stohr
Alexander Stohr
Asked: 2019-07-26 07:33:49 +0800 CST2019-07-26 07:33:49 +0800 CST 2019-07-26 07:33:49 +0800 CST

如何使用 apt 和 gpg 从防火墙后面将 gcc/gpp 6 到 9 安装到 Xenial 系统上?

  • 772

我尝试让 Ubuntu 16.04 (xenial) 的编译器高于 gcc/gpp-5。

我将这些行添加到 /etc/apt/sources.list

deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main
deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main

deb http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial main
deb-src http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial main

之后运行“apt update”时,我得到了这个:

Err:9 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial InRelease
 The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1E9377A2BA9EF27F
Err:16 http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8CF63AD3F06FC659

然后我尝试添加键:

# apt-key adv --keyserver keyserver.ubuntu.com --recv-key 1E9377A2BA9EF27F
Executing: /tmp/tmp.hQqulW3vSQ/gpg.1.sh --keyserver
keyserver.ubuntu.com
--recv-key
1E9377A2BA9EF27F
> gpg: requesting key BA9EF27F from hkp server keyserver.ubuntu.com
gpgkeys: key 1E9377A2BA9EF27F not found on keyserver
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
gpg: keyserver communications error: key not found
gpg: keyserver communications error: bad public key
gpg: keyserver receive failed: bad public key

# apt-key adv --keyserver keyserver.ubuntu.com --recv-key 8CF63AD3F06FC659
Executing: /tmp/tmp.9sbMVJgRDb/gpg.1.sh --keyserver
keyserver.ubuntu.com
--recv-key
8CF63AD3F06FC659
gpg: requesting key F06FC659 from hkp server keyserver.ubuntu.com
gpgkeys: key 8CF63AD3F06FC659 not found on keyserver
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
gpg: keyserver communications error: key not found
gpg: keyserver communications error: bad public key
gpg: keyserver receive failed: bad public key

如何简单地为该平台获取一组更新的编译器?

我发现在防火墙后面很难实现这样的目标。标准食谱不起作用,甚至“sudo -E”对我来说都失败了。而且我目前不知道如何改进 apt-* 工具集的调试打印。

gnupg proxy gcc 16.04 g++
  • 1 1 个回答
  • 735 Views

1 个回答

  • Voted
  1. Best Answer
    Alexander Stohr
    2019-07-27T04:32:02+08:002019-07-27T04:32:02+08:00

    (该解决方案的开发部分基于 N0rbert 和我在他最初提案中的对话)

    对问题的理解发展到发现“gpg”访问是有问题/悬空操作的地步。用户“nobar”的评论对获得最终线索最有帮助:

    gpg: no valid OpenPGP data found.
    
    In this scenario, the message is a cryptic way of telling you that the download failed.
    

    查看那里讨论的全尺寸主题:https ://stackoverflow.com/questions/21338721/gpg-no-valid-openpgp-data-found

    现在做一个工作来解决这里的主题中的问题......

    转到http://keyserver.ubuntu.com/ - 对于每个缺少的密钥(BA9EF27F / F06FC659),请执行以下操作:

    • 在提供的输入框中输入带有“0x”前缀的每个缺少的键
    • 选择“获取匹配键的详细索引”的单选按钮
    • 单击“搜索密钥”按钮
    • 在结果页面中,单击“pub”行中的链接并将目标网页保存到您的下载文件夹(我使用了短 keyId 和 *.txt 扩展名;实际上它是一个 HTML 文件内容,但这是一个很好的做法'不在乎)
    • 为每个下载的文件以 root 身份运行以下命令:

      apt-key add ***name-of-the-file***
      

    当上述操作完成两次(每个键一次)然后运行它以检查它是否有效:

    apt update
    

    除了其他几行之外,结果还应包含类似以下行的内容:

    Get:23 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main Sources [13.4 kB]
    Get:24 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main amd64 Packages [86.8 kB]
    Get:25 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main i386 Packages [85.1 kB]
    Get:27 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main Translation-en [14.4 kB]
    Get:28 http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial/main Sources [12.1 kB]
    Get:29 http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial/main amd64 Packages [79.7 kB]
    Get:30 http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial/main i386 Packages [78.4 kB]
    Get:31 http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial/main Translation-en [15.7 kB]
    

    最后的操作是安装您选择的额外 gcc 版本:

    apt install gcc-6 g++-6
    apt install gcc-7 g++-7
    apt install gcc-8 g++-8
    apt install gcc-9 g++-9
    

    这对我来说终于成功了。所有项目均从 amd64 存储库版本中的http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu获得。如果我想在另一个 PPA 上设置更高的优先级,我想我需要交换 sources.list 文件中的行。

    现在检查已安装的 gcc 二进制文件的版本返回以下文本:

    # gcc-6 --version
    gcc-6 (Ubuntu 6.5.0-2ubuntu1~16.04) 6.5.0 20181026
    Copyright (C) 2017 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    # gcc-7 --version
    gcc-7 (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1) 7.4.0
    Copyright (C) 2017 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    # gcc-8 --version
    gcc-8 (Ubuntu 8.3.0-16ubuntu3~16.04) 8.3.0
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    # gcc-9 --version
    gcc-9 (Ubuntu 9.1.0-2ubuntu2~16.04) 9.1.0
    Copyright (C) 2019 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    

    现在检查已安装的 g++ 二进制文件的版本返回以下文本:

    # g++-6 --version
    g++-6 (Ubuntu 6.5.0-2ubuntu1~16.04) 6.5.0 20181026
    Copyright (C) 2017 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    # g++-7 --version
    g++-7 (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1) 7.4.0
    Copyright (C) 2017 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    # g++-8 --version
    g++-8 (Ubuntu 8.3.0-16ubuntu3~16.04) 8.3.0
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    # g++-9 --version
    g++-9 (Ubuntu 9.1.0-2ubuntu2~16.04) 9.1.0
    Copyright (C) 2019 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    

    更新: 这些命令(截至目前)显然使用 Jonathon PPA:

    # apt install clang
    

    目前该命令导致此版本:

    $ clang --version
    clang version 3.8.0-2ubuntu3~trusty5 (tags/RELEASE_380/final)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /usr/bin
    
    # clang++ --version
    clang version 3.8.0-2ubuntu3~trusty5 (tags/RELEASE_380/final)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /usr/bin
    
    • 1

相关问题

  • 为什么应用系统范围的网络代理设置只影响超级用户(root)?[关闭]

  • 如何检查是否真的应用了网络代理?

  • 在 Kmail 中配置 GPG

  • 备份软件源

  • 解决 apt-get BADSIG GPG 错误的最简单方法是什么?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve