postgres:无法安装 postgresql-contrib-9.1

postgres:无法安装 postgresql-contrib-9.1

我的系统版本是Ubuntu 13.10 64位。

我在 Rails 应用程序中设置 PostgreSQL 时遇到了这个问题。

我第一次运行它rake db:migrate并显示一个错误:

-- enable_extension("hstore")
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::UndefinedFile: ERROR:  could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory
: CREATE EXTENSION IF NOT EXISTS "hstore"/home/user/.rvm/gems/ruby-2.1.1/gems/rack-mini-profiler-0.9.1/lib/patches/sql_patches.rb:160:in `exec'
/home/user/.rvm/gems/ruby-2.1.1/gems/rack-mini-profiler-0.9.1/lib/patches/sql_patches.rb:160:in `async_exec'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `block in exec_no_cache'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/home/user/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `exec_no_cache'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `enable_extension'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:649:in `block in method_missing'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `block in say_with_time'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `say_with_time'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:641:in `method_missing'
/home/user/rails/bdfzer-sso/db/migrate/20140405014358_set_up_hstore.rb:3:in `change'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:595:in `exec_migration'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:578:in `block in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:577:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:752:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `block in transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:219:in `within_new_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `ddl_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:953:in `block in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `each'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:807:in `up'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:785:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/home/user/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/home/user/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
ActiveRecord::StatementInvalid: PG::UndefinedFile: ERROR:  could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory
: CREATE EXTENSION IF NOT EXISTS "hstore"
/home/user/.rvm/gems/ruby-2.1.1/gems/rack-mini-profiler-0.9.1/lib/patches/sql_patches.rb:160:in `exec'
/home/user/.rvm/gems/ruby-2.1.1/gems/rack-mini-profiler-0.9.1/lib/patches/sql_patches.rb:160:in `async_exec'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `block in exec_no_cache'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/home/user/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `exec_no_cache'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `enable_extension'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:649:in `block in method_missing'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `block in say_with_time'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `say_with_time'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:641:in `method_missing'
/home/user/rails/bdfzer-sso/db/migrate/20140405014358_set_up_hstore.rb:3:in `change'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:595:in `exec_migration'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:578:in `block in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:577:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:752:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `block in transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:219:in `within_new_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `ddl_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:953:in `block in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `each'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:807:in `up'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:785:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/home/user/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/home/user/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
PG::UndefinedFile: ERROR:  could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory
/home/user/.rvm/gems/ruby-2.1.1/gems/rack-mini-profiler-0.9.1/lib/patches/sql_patches.rb:160:in `exec'
/home/user/.rvm/gems/ruby-2.1.1/gems/rack-mini-profiler-0.9.1/lib/patches/sql_patches.rb:160:in `async_exec'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `block in exec_no_cache'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/home/user/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `exec_no_cache'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `enable_extension'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:649:in `block in method_missing'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `block in say_with_time'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `say_with_time'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:641:in `method_missing'
/home/user/rails/bdfzer-sso/db/migrate/20140405014358_set_up_hstore.rb:3:in `change'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:595:in `exec_migration'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:578:in `block in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:577:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:752:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `block in transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:219:in `within_new_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `ddl_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:953:in `block in migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `each'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:807:in `up'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:785:in `migrate'
/home/user/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/home/user/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/home/user/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

经过一番搜索,我在 SO 上找到了一篇帖子,表明我可以运行

sudo apt-get install postgresql-contrib-9.1

但我得到的是

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package postgresql-contrib-9.1 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
However the following packages replace it:
  postgresql-9.1

E: Package 'postgresql-contrib-9.1' has no installation candidate

相关内容