postgresql-9.3 - ubuntu 15.04 安装 postgresql

标签 postgresql-9.3 ubuntu-15.04

我按照这篇文章安装了postgres https://gorails.com/setup/ubuntu/15.04

但是我在尝试启动 postgresql 时遇到此错误

vihaan@trojan:~$ sudo -u postgres createuser vihaan -s
createuser: could not connect to database postgres: could not connect to server: No such file or directory
            Is the server running locally and accepting
            connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

以下是来自 postgres 软件包安装的消息。

vihaan@trojan:~$ sudo apt-get install postgresql-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  dkms libgsoap5 libsdl1.2debian libvncserver0
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  postgresql-client-common
The following NEW packages will be installed:
  postgresql-client-common postgresql-common
0 upgraded, 2 newly installed, 0 to remove and 97 not upgraded.
Need to get 0 B/300 kB of archives.
After this operation, 816 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package postgresql-client-common.
(Reading database ... 180173 files and directories currently installed.)
Preparing to unpack .../postgresql-client-common_169.pgdg12.4+1_all.deb ...
Unpacking postgresql-client-common (169.pgdg12.4+1) ...
Selecting previously unselected package postgresql-common.
Preparing to unpack .../postgresql-common_169.pgdg12.4+1_all.deb ...
Adding 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Unpacking postgresql-common (169.pgdg12.4+1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for systemd (219-7ubuntu6) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up postgresql-client-common (169.pgdg12.4+1) ...
Setting up postgresql-common (169.pgdg12.4+1) ...

Creating config file /etc/postgresql-common/createcluster.conf with new version

Creating config file /etc/logrotate.d/postgresql-common with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
  en_au
  en_gb
  en_us
  en_za
Removing obsolete dictionary files:
Processing triggers for systemd (219-7ubuntu6) ...
Processing triggers for ureadahead (0.100.0-19) ...
vihaan@trojan:~$ sudo apt-get install postgresql-9.3 libpq-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libpq-dev is already the newest version.
The following packages were automatically installed and are no longer required:
  dkms libgsoap5 libsdl1.2debian libvncserver0
Use 'apt-get autoremove' to remove them.
Suggested packages:
  oidentd ident-server locales-all postgresql-doc-9.3
The following NEW packages will be installed:
  postgresql-9.3 postgresql-client-9.3
0 upgraded, 2 newly installed, 0 to remove and 97 not upgraded.
Need to get 0 B/4,497 kB of archives.
After this operation, 21.9 MB of additional disk space will be used.
Selecting previously unselected package postgresql-client-9.3.
(Reading database ... 180293 files and directories currently installed.)
Preparing to unpack .../postgresql-client-9.3_9.3.9-1.pgdg12.4+1_amd64.deb ...
Unpacking postgresql-client-9.3 (9.3.9-1.pgdg12.4+1) ...
Selecting previously unselected package postgresql-9.3.
Preparing to unpack .../postgresql-9.3_9.3.9-1.pgdg12.4+1_amd64.deb ...
Unpacking postgresql-9.3 (9.3.9-1.pgdg12.4+1) ...
Processing triggers for postgresql-common (169.pgdg12.4+1) ...
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
  en_au
  en_gb
  en_us
  en_za
Removing obsolete dictionary files:
Setting up postgresql-client-9.3 (9.3.9-1.pgdg12.4+1) ...
update-alternatives: using /usr/share/postgresql/9.3/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
Setting up postgresql-9.3 (9.3.9-1.pgdg12.4+1) ...
Creating new cluster 9.3/main ...
  config /etc/postgresql/9.3/main
  data   /var/lib/postgresql/9.3/main
  locale en_IN
Flags of /var/lib/postgresql/9.3/main set as -------------e-C
  port   5432
update-alternatives: using /usr/share/postgresql/9.3/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
vihaan@trojan:~$ sudo -u postgres createuser vihaan -s
createuser: could not connect to database postgres: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

最佳答案

您安装了错误的软件包:apt-get install postgresql 或阅读此tutorial了解更多信息。

在您提到的帖子中,您可能错过了运行此步骤: sudo apt-get install postgresql-9.3 libpq-dev

关于postgresql-9.3 - ubuntu 15.04 安装 postgresql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30966996/

相关文章:

python - 在 Python 中创建 Postgres 函数

android - 无法运行 android/sdk/build-tools/23.0.2/aapt

nginx - uWSGI 使用 systemd 自动启动

ubuntu - ipython 笔记本升级到 Ubuntu 15.04 后停止工作

postgresql - 刷新物化 View : Concurrency, 事务行为

postgresql - 无法在 Windows 8.1 上安装 Postgres

sql - 使用 order by 时在大表上查询速度慢

PostgreSQL:重复的键值违反了 UPDATE 命令的唯一约束

python - 使 .py 文件在 ubuntu 15.04 中可执行