无法在ubuntu软件包上安装postgres


10

我正在使用Ruby和Postgres设置VPS。在我的本地机器上,我安装了postgresql 9.2.3(客户端和服务器),因此想在我的VPS上安装它。按照此博客文章的说明http://hendrelouw73.wordpress.com/2012/11/14/how-to-install-postgresql-9-1-on-ubuntu-12-10-linux/在ubuntu上安装postgres (唯一的区别是我尝试安装9.2.3。他安装了9.1),我做了以下工作

sudo apt-get install postgresql-9.2.3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package postgresql-9.2.3
E: Couldn't find any package by regex 'postgresql-9.2.3'

但是,如您所见,它找不到包postgresql-9.2.3。但是,我已经在本地计算机上安装了该软件包(我使用Homebrew在Mac上安装了该软件包)。

您能帮助我了解我在做什么错吗?

更新我还尝试安装它,最后没有显示“ 3”,就像您在下面看到的那样,但是您无法看到它的工作。

 sudo apt-get install postgresql-9.2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package postgresql-9.2 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

E: Package 'postgresql-9.2' has no installation candidate

更新资料

Ign http://security.ubuntu.com quantal-security InRelease
Ign http://archive.ubuntu.com quantal InRelease
Hit http://security.ubuntu.com quantal-security Release.gpg
Ign http://archive.ubuntu.com quantal-updates InRelease
Hit http://security.ubuntu.com quantal-security Release
Hit http://archive.ubuntu.com quantal Release.gpg
Get:1 http://archive.ubuntu.com quantal-updates Release.gpg [933 B]
Hit http://security.ubuntu.com quantal-security/main i386 Packages
Hit http://archive.ubuntu.com quantal Release
Get:2 http://archive.ubuntu.com quantal-updates Release [49.6 kB]
Hit http://security.ubuntu.com quantal-security/main Translation-en
Hit http://archive.ubuntu.com quantal/main i386 Packages 
Hit http://archive.ubuntu.com quantal/universe i386 Packages
Ign http://security.ubuntu.com quantal-security/main Translation-en_US
Hit http://archive.ubuntu.com quantal/main Translation-en
Hit http://archive.ubuntu.com quantal/universe Translation-en
Get:3 http://archive.ubuntu.com quantal-updates/main i386 Packages [259 kB]
Get:4 http://archive.ubuntu.com quantal-updates/universe i386 Packages [192 kB]
Hit http://archive.ubuntu.com quantal-updates/main Translation-en
Hit http://archive.ubuntu.com quantal-updates/universe Translation-en
Ign http://archive.ubuntu.com quantal/main Translation-en_US
Ign http://archive.ubuntu.com quantal/universe Translation-en_US
Ign http://archive.ubuntu.com quantal-updates/main Translation-en_US
Ign http://archive.ubuntu.com quantal-updates/universe Translation-en_US
Fetched 501 kB in 3s (148 kB/s)
Reading package lists... Done
postgresql-9.1 - object-relational SQL database, version 9.1 server
postgresql-9.1-dbg - debug symbols for postgresql-9.1
postgresql-9.1-debversion - Debian version number type for PostgreSQL
postgresql-9.1-ip4r - IPv4 and IPv4 range index types for PostgreSQL 9.1
postgresql-9.1-orafce - Oracle support functions for PostgreSQL 9.1
postgresql-9.1-pgfincore - set of PostgreSQL functions to manage blocks in memory
postgresql-9.1-pgmemcache - PostgreSQL interface to memcached
postgresql-9.1-pgmp - arbitrary precision integers and rationals for PostgreSQL 9.1
postgresql-9.1-pgpool2 - connection pool server and replication proxy for PostgreSQL - modules
postgresql-9.1-pljava-gcj - Java procedural language for PostgreSQL 9.1
postgresql-9.1-pllua - Lua procedural language for PostgreSQL 9.1
postgresql-9.1-plproxy - database partitioning system for PostgreSQL 9.1
postgresql-9.1-plr - Procedural language interface between PostgreSQL and R
postgresql-9.1-plsh - PL/sh procedural language for PostgreSQL 9.1
postgresql-9.1-postgis - Geographic objects support for PostgreSQL 9.1
postgresql-9.1-prefix - Prefix Range module for PostgreSQL
postgresql-9.1-preprepare - Pre Prepare your Statement server side
postgresql-9.1-slony1-2 - replication system for PostgreSQL: PostgreSQL 9.1 server plug-in

1
哪些呢apt-get update && apt-cache search ^postgresql-9输出?
dawud

@dawud在OP的更新中发布了运行该内容的内容。
迈克尔

因此,您如何期望安装不可用的软件包?
dawud

@dawud自从我在本地计算机上安装9.2.3(使用Homebrew)以来,我没有考虑它不可用的可能性。这是我第一次设置VPS。为什么不可用?
迈克尔(Michael

Answers:


25

在Ubuntu官方存储库中,仅PostgreSQL 9.1可用。这就是为什么找不到它的原因。

为了使用apt在您的VPS中获取PostgreSQL v9.2,您应该遵循在此处找到的Ubuntu的官方PostgreSQL程序。

它包括将PostgreSQL官方存储库添加为您的存储库源之一

  1. 创建文件 /etc/apt/sources.list.d/pgdg.list

  2. 插入这行 deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main

  3. 导入存储库签名密钥 wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

  4. 刷新您的存储库缓存 sudo apt-get update

现在您可以简单地做 sudo apt-get install postgresql-9.2


1
不知道有这个回购。+1
dawud

1
非常感谢。瞧,就连我的问题也无济于事,帮助了有经验的用户....
Michael

我发现此页面对wiki.postgresql.org/wiki/Apt很有帮助。您还可以安装postgres-contrib-9.2
nueverest,2014年

3

能够使用不同存储库安装postgresql-9.2.3不同操作系统上的事实并不重要。

如果使用Web或通过来查询Ubuntu存储库apt,则会注意到,quantal附带的版本是9.1。

之所以postgresql-9.2.3无法提供定量的确切原因,是因为它在冻结时尚未在发布的发行版中接受。

postgresql-9.2.3在Ubuntu中使用,您需要自己编译。有几种方法,例如使用checkinstall或fpm向后移植或打包上游发行版。


感谢您的解释。我有点像新手要管理专业的服务器:(
Michael
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.