代码之家  ›  专栏  ›  技术社区  ›  icicleking

如何修复postgres安装ubuntu的错误

  •  0
  • icicleking  · 技术社区  · 7 年前

    我正在努力修复postgres客户端的安装错误。我正在一个持续集成构建上安装这个,所以我需要它安装没有错误。问题是,客户端已经安装,我甚至可以运行 psql 命令,如果我 ssh 进入服务器,但我需要这个运行没有我的触摸,这意味着安装必须发生没有错误。 我已经完成了所有的google foo,我在ubuntu论坛或这里看到的建议都没有指向正确的方向。这都在ubuntu 14.04上。

    或者,只要客户机是可用的,我就可以消除错误。

    以下是我遇到的错误:

    sudo apt-get install postgresql-client
    
        Reading package lists... Done
    
    
        Building dependency tree       
    
    
        Reading state information... Done
    
        The following additional packages will be installed:
          libpq5 postgresql-client-9.6 postgresql-client-common
        Suggested packages:
          postgresql-9.6 postgresql-doc-9.6
        The following NEW packages will be installed:
          libpq5 postgresql-client postgresql-client-9.6 postgresql-client-common
        0 upgraded, 4 newly installed, 0 to remove and 7 not upgraded.
        Need to get 1494 kB of archives.
        After this operation, 6121 kB of additional disk space will be used.
    
        Get:1 http://deb.debian.org/debian stretch/main amd64 libpq5 amd64 9.6.7-0+deb9u1 [132 kB]
    
        Get:2 http://deb.debian.org/debian stretch/main amd64 postgresql-client-common all 181+deb9u1 [79.0 kB]
    
        Get:3 http://deb.debian.org/debian stretch/main amd64 postgresql-client-9.6 amd64 9.6.7-0+deb9u1 [1228 kB]
    
        Get:4 http://deb.debian.org/debian stretch/main amd64 postgresql-client all 9.6+181+deb9u1 [55.7 kB]
    
        Fetched 1494 kB in 0s (55.5 MB/s)
        debconf: delaying package configuration, since apt-utils is not installed
        Selecting previously unselected package libpq5:amd64.
        (Reading database ... 31433 files and directories currently installed.)
        Preparing to unpack .../libpq5_9.6.7-0+deb9u1_amd64.deb ...
        Unpacking libpq5:amd64 (9.6.7-0+deb9u1) ...
        Selecting previously unselected package postgresql-client-common.
        Preparing to unpack .../postgresql-client-common_181+deb9u1_all.deb ...
        Unpacking postgresql-client-common (181+deb9u1) ...
        Selecting previously unselected package postgresql-client-9.6.
        Preparing to unpack .../postgresql-client-9.6_9.6.7-0+deb9u1_amd64.deb ...
        Unpacking postgresql-client-9.6 (9.6.7-0+deb9u1) ...
        Selecting previously unselected package postgresql-client.
        Preparing to unpack .../postgresql-client_9.6+181+deb9u1_all.deb ...
        Unpacking postgresql-client (9.6+181+deb9u1) ...
        Setting up libpq5:amd64 (9.6.7-0+deb9u1) ...
        Processing triggers for libc-bin (2.24-11+deb9u3) ...
        Setting up postgresql-client-common (181+deb9u1) ...
        Setting up postgresql-client-9.6 (9.6.7-0+deb9u1) ...
        update-alternatives: using /usr/share/postgresql/9.6/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
        update-alternatives: error: error creating symbolic link '/usr/share/man/man7/ABORT.7.gz.dpkg-tmp': No such file or directory
        dpkg: error processing package postgresql-client-9.6 (--configure):
         subprocess installed post-installation script returned error exit status 2
        dpkg: dependency problems prevent configuration of postgresql-client:
         postgresql-client depends on postgresql-client-9.6; however:
          Package postgresql-client-9.6 is not configured yet.
    
        dpkg: error processing package postgresql-client (--configure):
         dependency problems - leaving unconfigured
        Errors were encountered while processing:
         postgresql-client-9.6
         postgresql-client
        E: Sub-process /usr/bin/dpkg returned an error code (1)
        Exited with code 100
    
    

    我试过以下方法来修复:

        sudo apt-get purge postgr*
        sudo apt-get autoremove
        sudo apt-get install synaptic
        sudo apt-get update
    
    

    发件人: https://ubuntuforums.org/showthread.php?t=2277582

        which psql
        /usr/bin/psql
    
    

    以及

        more /etc/apt/sources.list
        deb http://deb.debian.org/debian stretch main
        deb http://deb.debian.org/debian stretch-updates main
        deb http://security.debian.org/debian-security stretch/updates main
    
    

    我对如何前进感到困惑。

    1 回复  |  直到 7 年前
        1
  •  8
  •   Rafael Lebre    6 年前

    我的ci构建也遇到了同样的问题,我找到了创建类似@a.scherbaum提到的文件夹的解决方法。

    sudo mkdir -p /usr/share/man/man1
    sudo mkdir -p /usr/share/man/man7
    sudo apt-get update
    sudo apt-get install postgresql-client
    

    我在这里找到了这个解决方案 commit 通过这个 issue

    不过,我也做了测试,像你说的那样消除了错误,而且成功了,但我不知道结果如何

    sudo apt-get install postgresql-client || true
    

    我在这里面发现了类似的东西 circleci article