質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
PostgreSQL

PostgreSQLはオープンソースのオブジェクトリレーショナルデータベース管理システムです。 Oracle Databaseで使われるPL/SQLを参考に実装されたビルトイン言語で、Windows、 Mac、Linux、UNIX、MSなどいくつものプラットフォームに対応しています。

Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

Q&A

解決済

1回答

3867閲覧

postgresqlの起動 postgres: unrecognized serviceのエラー

退会済みユーザー

退会済みユーザー

総合スコア0

PostgreSQL

PostgreSQLはオープンソースのオブジェクトリレーショナルデータベース管理システムです。 Oracle Databaseで使われるPL/SQLを参考に実装されたビルトイン言語で、Windows、 Mac、Linux、UNIX、MSなどいくつものプラットフォームに対応しています。

Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

0グッド

0クリップ

投稿2020/02/16 00:06

編集2020/02/16 00:13

前提・実現したいこと

Windows10 ubuntu18
Railsから利用できるように、PostgreSQLを起動したいです

$sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' $wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - $sudo apt update $sudo apt-get install postgresql-client-12 $psql -V psql (PostgreSQL) 12.2 (Ubuntu 12.2-1.pgdg18.04+1) $sudo service postgresql start エラー

以下のエラーメッセージが発生しました。

発生している問題・エラーメッセージ

postgres: unrecognized service

該当のソースコード

sudo service postgresql start

試したこと

$psql psql: error: could not connect to server: 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"? $ sudo su - postgres No directory, logging in with HOME=/ mkdir: cannot create directory ‘//.cache’: Permission denied -su: //.cache/wslu/integration: No such file or directory

補足情報(FW/ツールのバージョンなど)

ここにより詳細な情報を記載してください。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

amura

2020/02/16 00:32

postgresql-client-12でクライアントのインストールしておりますが、本体のインストールは終了しておりますでしょうか?
退会済みユーザー

退会済みユーザー

2020/02/16 00:51 編集

していないかもしれません。 sudo apt install postgresql を実行したんですが Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: postgresql : Depends: postgresql-12 but it is not going to be installed E: Unable to correct problems, you have held broken packages. というエラーが出てしまいます
退会済みユーザー

退会済みユーザー

2020/02/16 01:09

ここで質問する前に試してみたんですが変化がありませんでした。
amura

2020/02/16 01:19

aptitude もお試しになられましたか?
退会済みユーザー

退会済みユーザー

2020/02/16 02:05 編集

すいません、始めて二週間ぐらいの初心者なので aptitubeの使い方がわかりません $sudo aptitude update を実行したら コマンドが見つかりませんとエラーがでました $sudo apt install aptitude E: Package 'aptitude' has no installation candidate
amura

2020/02/16 01:49

失礼しました。新しいのは、aptitude が無くなっています。非推奨の様です。
退会済みユーザー

退会済みユーザー

2020/02/16 02:08

わかりました。
amura

2020/02/16 05:05

Depends: postgresql-12 と言われているので sudo apt install postgresql-12と指定するではどうでしょうか?
退会済みユーザー

退会済みユーザー

2020/02/16 05:43

The following packages have unmet dependencies: postgresql-12 : Depends: postgresql-common (>= 182~) but it is not going to be installed Depends: ssl-cert but it is not installable Depends: libllvm6.0 (>= 1:6.0~svn298832-1~) but it is not installable Recommends: sysstat but it is not installable E: Unable to correct problems, you have held broken packages. 指定してみたんですがエラーでした
guest

回答1

0

ベストアンサー

回答でなく大変申し訳ありません。多少違いますが同じ作業にて作成できました(参考です)

#リポジトリの追加 $ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' #認証キーを追加 $ sudo apt-get install curl ca-certificates $ curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - #リポジトリを更新 $ sudo apt update $ sudo apt upgrade #インストール実行 $ sudo apt install postgresql-12 #起動 sudo su - postgres pg_ctlcluster 12 main start #確認 psql -l

postgres@DESKTOP-TAL1BO0:~$ psql -l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+---------+-----------------------
postgres | postgres | UTF8 | C.UTF-8 | C.UTF-8 |
template0 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)

投稿2020/02/16 07:33

amura

総合スコア333

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2020/02/16 08:32

ご丁寧に回答していただき本当にありがとうございます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問