我正在用
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/for在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.然而,我在我的本地机器上安装了该软件包(我在Mac上安装了Homebrew).
你能帮我理解我做错了什么吗?
更新
我也尝试安装它,在最后留下’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
在Ubuntu官方存储库中只有Postgresql 9.1可用.这就是无法找到它的原因.
为了使用apt在你的VPS中获得Postgresql v9.2,你应该按照Ubuntu的官方Postgresql程序找到here
它包括添加Postgresql官方存储库作为您的存储库源之一
>创建文件/etc/apt/sources.list.d/pgdg.list
>插入此行deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main
>导入存储库签名密钥wget –quiet -O – https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add –
>刷新您的存储库缓存sudo apt-get update
现在你可以简单地做sudo apt-get install postgresql-9.2