我是 Linux 系统新手。我尝试安装 PostgreSQL 9.2。我做了以下事情:
sudo apt-get update
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get -y install postgresql-9.2 postgresql-client-9.2 postgresql-contrib-9.2
但它说找不到包。我读了一些教程,到处都写着我需要使用存储ppa:pitti/postgresql
库。
怎么了?
更新1
我成功安装了 @slm 答案中的软件包,但无法启动 postgres。当我尝试时psql
我得到:
Command psql can be found in packages:
* postgresql-client-common
* postgres-xc-client
我也没有看到文件/etc/init.d/postgresql
。
更新2
$ dpkg -L postgresql-contrib-9.2
/.
/usr
/usr/lib
/usr/lib/postgresql
/usr/lib/postgresql/9.2
/usr/lib/postgresql/9.2/lib
/usr/lib/postgresql/9.2/lib/test_parser.so
/usr/lib/postgresql/9.2/lib/btree_gist.so
/usr/lib/postgresql/9.2/lib/pgstattuple.so
/usr/lib/postgresql/9.2/lib/pg_buffercache.so
/usr/lib/postgresql/9.2/lib/cube.so
/usr/lib/postgresql/9.2/lib/unaccent.so
/usr/lib/postgresql/9.2/lib/earthdistance.so
/usr/lib/postgresql/9.2/lib/pgrowlocks.so
/usr/lib/postgresql/9.2/lib/insert_username.so
/usr/lib/postgresql/9.2/lib/moddatetime.so
/usr/lib/postgresql/9.2/lib/isn.so
/usr/lib/postgresql/9.2/lib/lo.so
/usr/lib/postgresql/9.2/lib/chkpass.so
/usr/lib/postgresql/9.2/lib/passwordcheck.so
/usr/lib/postgresql/9.2/lib/pg_freespacemap.so
/usr/lib/postgresql/9.2/lib/auth_delay.so
/usr/lib/postgresql/9.2/lib/pgcrypto.so
/usr/lib/postgresql/9.2/lib/pgxml.so
/usr/lib/postgresql/9.2/lib/btree_gin.so
/usr/lib/postgresql/9.2/lib/seg.so
/usr/lib/postgresql/9.2/lib/tcn.so
/usr/lib/postgresql/9.2/lib/auto_explain.so
/usr/lib/postgresql/9.2/lib/file_fdw.so
/usr/lib/postgresql/9.2/lib/uuid-ossp.so
/usr/lib/postgresql/9.2/lib/refint.so
/usr/lib/postgresql/9.2/lib/dict_int.so
/usr/lib/postgresql/9.2/lib/ltree.so
/usr/lib/postgresql/9.2/lib/tablefunc.so
/usr/lib/postgresql/9.2/lib/dummy_seclabel.so
/usr/lib/postgresql/9.2/lib/dict_xsyn.so
/usr/lib/postgresql/9.2/lib/adminpack.so
/usr/lib/postgresql/9.2/lib/fuzzystrmatch.so
/usr/lib/postgresql/9.2/lib/pg_trgm.so
/usr/lib/postgresql/9.2/lib/pg_stat_statements.so
/usr/lib/postgresql/9.2/lib/autoinc.so
/usr/lib/postgresql/9.2/lib/timetravel.so
/usr/lib/postgresql/9.2/lib/dblink.so
/usr/lib/postgresql/9.2/lib/sslinfo.so
/usr/lib/postgresql/9.2/lib/_int.so
/usr/lib/postgresql/9.2/lib/hstore.so
/usr/lib/postgresql/9.2/lib/pageinspect.so
/usr/lib/postgresql/9.2/lib/citext.so
/usr/lib/postgresql/9.2/bin
/usr/lib/postgresql/9.2/bin/pgbench
/usr/lib/postgresql/9.2/bin/pg_standby
/usr/lib/postgresql/9.2/bin/pg_archivecleanup
/usr/lib/postgresql/9.2/bin/vacuumlo
/usr/lib/postgresql/9.2/bin/pg_test_timing
/usr/lib/postgresql/9.2/bin/pg_test_fsync
/usr/lib/postgresql/9.2/bin/oid2name
/usr/share
/usr/share/doc
/usr/share/doc/postgresql-contrib-9.2
/usr/share/doc/postgresql-contrib-9.2/copyright
/usr/share/doc/postgresql-contrib-9.2/autoinc.example
/usr/share/doc/postgresql-contrib-9.2/changelog.gz
/usr/share/doc/postgresql-contrib-9.2/changelog.Debian.gz
/usr/share/doc/postgresql-contrib-9.2/moddatetime.example
/usr/share/doc/postgresql-contrib-9.2/refint.example
/usr/share/doc/postgresql-contrib-9.2/insert_username.example
/usr/share/doc/postgresql-contrib-9.2/timetravel.example
/usr/share/postgresql
/usr/share/postgresql/9.2
/usr/share/postgresql/9.2/extension
/usr/share/postgresql/9.2/extension/pgstattuple.control
/usr/share/postgresql/9.2/extension/uuid-ossp.control
/usr/share/postgresql/9.2/extension/dblink--1.0.sql
/usr/share/postgresql/9.2/extension/dblink.control
/usr/share/postgresql/9.2/extension/timetravel.control
/usr/share/postgresql/9.2/extension/citext.control
/usr/share/postgresql/9.2/extension/xml2--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/isn.control
/usr/share/postgresql/9.2/extension/pageinspect.control
/usr/share/postgresql/9.2/extension/intarray.control
/usr/share/postgresql/9.2/extension/insert_username--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/refint--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/seg--1.0.sql
/usr/share/postgresql/9.2/extension/pg_stat_statements.control
/usr/share/postgresql/9.2/extension/tcn--1.0.sql
/usr/share/postgresql/9.2/extension/refint.control
/usr/share/postgresql/9.2/extension/lo--1.0.sql
/usr/share/postgresql/9.2/extension/pageinspect--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/isn--1.0.sql
/usr/share/postgresql/9.2/extension/tablefunc--1.0.sql
/usr/share/postgresql/9.2/extension/test_parser--1.0.sql
/usr/share/postgresql/9.2/extension/sslinfo--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/moddatetime.control
/usr/share/postgresql/9.2/extension/intagg.control
/usr/share/postgresql/9.2/extension/timetravel--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/insert_username.control
/usr/share/postgresql/9.2/extension/hstore--1.0--1.1.sql
/usr/share/postgresql/9.2/extension/moddatetime--1.0.sql
/usr/share/postgresql/9.2/extension/file_fdw--1.0.sql
/usr/share/postgresql/9.2/extension/tsearch2--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/pg_freespacemap--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/pg_stat_statements--1.0--1.1.sql
/usr/share/postgresql/9.2/extension/isn--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/pg_trgm--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/btree_gist--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/earthdistance--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/refint--1.0.sql
/usr/share/postgresql/9.2/extension/btree_gin--1.0.sql
/usr/share/postgresql/9.2/extension/autoinc.control
/usr/share/postgresql/9.2/extension/pgcrypto.control
/usr/share/postgresql/9.2/extension/pg_trgm.control
/usr/share/postgresql/9.2/extension/btree_gin.control
/usr/share/postgresql/9.2/extension/seg.control
/usr/share/postgresql/9.2/extension/pg_trgm--1.0.sql
/usr/share/postgresql/9.2/extension/hstore--1.1.sql
/usr/share/postgresql/9.2/extension/test_parser.control
/usr/share/postgresql/9.2/extension/dict_xsyn--1.0.sql
/usr/share/postgresql/9.2/extension/sslinfo--1.0.sql
/usr/share/postgresql/9.2/extension/tablefunc--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/tcn.control
/usr/share/postgresql/9.2/extension/lo.control
/usr/share/postgresql/9.2/extension/uuid-ossp--1.0.sql
/usr/share/postgresql/9.2/extension/chkpass.control
/usr/share/postgresql/9.2/extension/btree_gin--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/fuzzystrmatch.control
/usr/share/postgresql/9.2/extension/timetravel--1.0.sql
/usr/share/postgresql/9.2/extension/cube--1.0.sql
/usr/share/postgresql/9.2/extension/dblink--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/insert_username--1.0.sql
/usr/share/postgresql/9.2/extension/ltree--1.0.sql
/usr/share/postgresql/9.2/extension/citext--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/ltree--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/pgstattuple--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/btree_gist--1.0.sql
/usr/share/postgresql/9.2/extension/dict_xsyn.control
/usr/share/postgresql/9.2/extension/pgcrypto--1.0.sql
/usr/share/postgresql/9.2/extension/uuid-ossp--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/pg_buffercache--1.0.sql
/usr/share/postgresql/9.2/extension/unaccent--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/seg--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/file_fdw.control
/usr/share/postgresql/9.2/extension/tsearch2--1.0.sql
/usr/share/postgresql/9.2/extension/fuzzystrmatch--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/lo--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/unaccent--1.0.sql
/usr/share/postgresql/9.2/extension/fuzzystrmatch--1.0.sql
/usr/share/postgresql/9.2/extension/intarray--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/autoinc--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/ltree.control
/usr/share/postgresql/9.2/extension/pg_buffercache--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/cube.control
/usr/share/postgresql/9.2/extension/pgcrypto--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/chkpass--1.0.sql
/usr/share/postgresql/9.2/extension/earthdistance--1.0.sql
/usr/share/postgresql/9.2/extension/pg_stat_statements--1.1.sql
/usr/share/postgresql/9.2/extension/pgrowlocks--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/pgrowlocks--1.0.sql
/usr/share/postgresql/9.2/extension/moddatetime--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/unaccent.control
/usr/share/postgresql/9.2/extension/dict_int--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/intarray--1.0.sql
/usr/share/postgresql/9.2/extension/pgstattuple--1.0.sql
/usr/share/postgresql/9.2/extension/pg_freespacemap--1.0.sql
/usr/share/postgresql/9.2/extension/autoinc--1.0.sql
/usr/share/postgresql/9.2/extension/tsearch2.control
/usr/share/postgresql/9.2/extension/test_parser--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/pageinspect--1.0.sql
/usr/share/postgresql/9.2/extension/pg_freespacemap.control
/usr/share/postgresql/9.2/extension/xml2--1.0.sql
/usr/share/postgresql/9.2/extension/citext--1.0.sql
/usr/share/postgresql/9.2/extension/chkpass--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/hstore--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/dict_int--1.0.sql
/usr/share/postgresql/9.2/extension/hstore.control
/usr/share/postgresql/9.2/extension/intagg--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/xml2.control
/usr/share/postgresql/9.2/extension/pgrowlocks.control
/usr/share/postgresql/9.2/extension/sslinfo.control
/usr/share/postgresql/9.2/extension/cube--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/adminpack--1.0.sql
/usr/share/postgresql/9.2/extension/pg_buffercache.control
/usr/share/postgresql/9.2/extension/pg_stat_statements--unpackaged--1.0.sql
/usr/share/postgresql/9.2/extension/btree_gist.control
/usr/share/postgresql/9.2/extension/intagg--1.0.sql
/usr/share/postgresql/9.2/extension/adminpack.control
/usr/share/postgresql/9.2/extension/dict_int.control
/usr/share/postgresql/9.2/extension/tablefunc.control
/usr/share/postgresql/9.2/extension/earthdistance.control
/usr/share/postgresql/9.2/man
/usr/share/postgresql/9.2/man/man1
/usr/share/postgresql/9.2/man/man1/pg_test_timing.1.gz
/usr/share/postgresql/9.2/man/man1/pg_test_fsync.1.gz
/usr/share/postgresql/9.2/man/man1/pg_standby.1.gz
/usr/share/postgresql/9.2/man/man1/pgbench.1.gz
/usr/share/postgresql/9.2/man/man1/oid2name.1.gz
/usr/share/postgresql/9.2/man/man1/pg_archivecleanup.1.gz
/usr/share/postgresql/9.2/man/man1/vacuumlo.1.gz
答案1
您可能想尝试这篇文章中描述的指导,标题为:在 Linux Mint 上安装最新的 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
安装 postgreSQL(以 root 身份运行所有这些命令)
$ sudo apt-get install postgresql-9.2 $ sudo apt-get install postgresql-contrib-9.2 $ sudo apt-get install pgadmin3
答案2
如果 psql 不起作用,可能是它不在 PATH 中。尝试查找 psql 并查看它是否存在。