1

我搜索但没有找到为什么我在安装时出错的答案:

$ sudo aptitude install postgresql-9.1 postgresql-contrib-9.1 python-pygresql libpq-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reading extended state information      
Initialising package states... Done
The following NEW packages will be installed:
  libossp-uuid16{a} postgresql-9.1 postgresql-common{a} postgresql-contrib-9.1 python-pygresql 
0 packages upgraded, 5 newly installed, 0 to remove and 32 not upgraded.
Need to get 0B/7,463kB of archives. After unpacking 21.2MB will be used.
Do you want to continue? [Y/n/?] Y
Writing extended state information... Done
Preconfiguring packages ...
Selecting previously deselected package libossp-uuid16.
(Reading database ... 414497 files and directories currently installed.)
Unpacking libossp-uuid16 (from .../libossp-uuid16_1.6.2-1ubuntu1_amd64.deb) ...
Selecting previously deselected package postgresql-common.
Unpacking postgresql-common (from .../postgresql-common_133~lucid_all.deb) ...
Adding `diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Selecting previously deselected package postgresql-9.1.
Unpacking postgresql-9.1 (from .../postgresql-9.1_9.1.4-1~lucid4_amd64.deb) ...
Selecting previously deselected package postgresql-contrib-9.1.
Unpacking postgresql-contrib-9.1 (from .../postgresql-contrib-9.1_9.1.4-1~lucid4_amd64.deb) ...
Selecting previously deselected package python-pygresql.
Unpacking python-pygresql (from .../python-pygresql_1%3a4.0-2_amd64.deb) ...
Processing triggers for ureadahead ...
Processing triggers for man-db ...
Setting up libossp-uuid16 (1.6.2-1ubuntu1) ...

Setting up postgresql-common (133~lucid) ...
"IN6ADDR_ANY" is not exported by the Socket module
Can't continue after import errors at /usr/share/postgresql-common/PgCommon.pm line 19
BEGIN failed--compilation aborted at /usr/share/postgresql-common/PgCommon.pm line 19.
Compilation failed in require at /usr/share/postgresql-common/run-upgrade-scripts line 18.
BEGIN failed--compilation aborted at /usr/share/postgresql-common/run-upgrade-scripts line 18.
"IN6ADDR_ANY" is not exported by the Socket module
Can't continue after import errors at /usr/share/postgresql-common/PgCommon.pm line 19
BEGIN failed--compilation aborted at /usr/share/postgresql-common/PgCommon.pm line 19.
Compilation failed in require at /usr/share/postgresql-common/pg_checksystem line 20.
BEGIN failed--compilation aborted at /usr/share/postgresql-common/pg_checksystem line 20.

Setting up postgresql-9.1 (9.1.4-1~lucid4) ...
**"IN6ADDR_ANY" is not exported by the Socket module
Can't continue after import errors at /usr/share/postgresql-common/PgCommon.pm line 19
BEGIN failed--compilation aborted at /usr/share/postgresql-common/PgCommon.pm line 19.
Compilation failed in require at /usr/bin/pg_createcluster line 19.
BEGIN failed--compilation aborted at /usr/bin/pg_createcluster line 19.
Error: could not create default cluster. Please create it manually with

  pg_createcluster 9.1 main --start

or a similar command (see 'man pg_createcluster').**
update-alternatives: using /usr/share/postgresql/9.1/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode.

Setting up postgresql-contrib-9.1 (9.1.4-1~lucid4) ...

Setting up python-pygresql (1:4.0-2) ...

Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for python-central ...
Reading package lists... Done             
Building dependency tree       
Reading state information... Done
Reading extended state information      
Initialising package states... Done
Writing extended state information... Done

我不知道什么是 IN6ADDR_ANY 以及如何将其设置为由 Socket 模块导出。在 sudo add-apt-repository ppa:pitti/postgresql 之后,我尝试在 ubuntu 10.04 上安装它

4

5 回答 5

3

问题是Socket模块没有更新,老版本的Socket没有导出IN6ADDR_ANY。(参见 /usr/lib/perl/5.12.4/Socket.pm)。我机器上的版本是 1.87_01,那个版本不导出 IN6ADDR_ANY。最新版本是 2.002。

问题可能是有人在打包新的 postgresql-9.1 dpkg 时忘记输入 Socket 2.002 作为依赖项。

修复方法是更新 Socket 模块:

$ sudo apt-get install libsocket-perl

如果这对您不起作用,请尝试通过 cpan 升级 Socket:

$ sudo apt-get install cpan
$ sudo cpan Socket

编辑:

如果 Socket 无法通过上述命令安装,并且出现消息“BEGIN failed--compilation aborted at Makefile.PL line 6”,请运行:

$ sudo cpan ExtUtils::Constant

这将为您提供 ExtUtils::Constant v0.23,这是更新 Socket 所必需的。然后您应该能够运行:

$ sudo cpan Socket

没有问题。

于 2012-07-26T20:40:15.960 回答
0

我使用了其他 ppa 并且它有效:

ppa:flexiondotorg/postgres

要删除旧的,我使用 ppa-purge 这种方式:

wget http://launchpadlibrarian.net/53004738/ppa-purge_0%2Bbzr46.1~lucid1_all.deb &&
sudo dpkg -i ppa-purge_0+bzr46.1~lucid1_all.deb
sudo ppa-purge ppa:pitti/postgresql

添加新的ppa:

sudo add-apt-repository ppa:flexiondotorg/postgres
sudo apt-get update
于 2012-07-26T17:19:08.563 回答
0

为了解决这个问题,我将 postgresql-client-common 和 postgresql-common 降级回之前的“130~lucid”版本。

幸运的是,这些包在我的 apt 存档中,位于我机器上的 /var/cache/apt/archives(运行 Ubuntu 10.10)。

只需使用 dpkg 安装它们

sudo dpkg -i postgresql-client-common_130~lucid_all.deb
sudo dpkg -i postgresql-common_130~lucid_all.deb
于 2012-07-26T20:20:01.977 回答
0

有趣的是,当我从 postgres 8.4 升级到 9.1 时,这件事发生在我身上的同一天发生在其他人身上。我遇到了完全相同的问题,并在正确的时间在这里找到了解决方案!

我 # /usr/share/postgresql-common/PgCommon.pm 中的第 19 行和第 684 行到第 687 行,就像某人(Billy Monk)昨天写的一样(显然现在更改或删除了他的帖子)。

它奏效了。

我现在将尝试更新套接字的解决方案。

非常感谢。

于 2012-07-27T07:54:48.640 回答
0

这对我有用(在 Ubuntu 10.04LTS 上):

$ sudo apt-get update
$ sudo apt-get install libcpan-mini-perl
$ sudo cpan ExtUtils::Constant
$ sudo cpan Socket
于 2012-07-27T12:54:22.763 回答