2015-06-21 156 views
1

我跟着這篇文章來安裝的Postgres https://gorails.com/setup/ubuntu/15.04的Ubuntu 15.04安裝PostgreSQL

但我米就試圖啓動PostgreSQL的

[email protected]:~$ 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的包安裝的消息。

[email protected]:~$ 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) ... 
[email protected]:~$ 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 
[email protected]:~$ 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"? 
+0

它看起來像DB發動機不運轉。你有沒有嘗試過:「sudo service postgresql9.3 start」或類似的東西。 –

回答

2

您已經安裝了錯誤的包:apt-get install postgresql 或者閱讀本tutorial更多的信息。

在你所提到的職位,你可能錯過運行此步驟: sudo apt-get install postgresql-9.3 libpq-dev