2023年08月21日

PostgREST 11.1.2 Ubuntu20.04LTS PostgreSQL15

PostgreSQL15のインストール
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-get update

sudo apt-get -y install postgresql

PostgreSQL15のパスワードの変更
sudo su - postgres 
psql
alter role postgres with password 'Passwd123';

PostgreSQL15の接続設定
sudo gedit /etc/postgresql/15/main/postgresql.conf
sudo gedit /etc/postgresql/15/main/pg_hba.conf

その他 Ubuntiのツールのインストール(これは、PostgRESTには関係ありません)



sudo apt install net-tools
sudo apt-get -y install baobab

PostgRESTのダウンロードと解凍



Tutorial 0 - Get it Running
を参考に、少し変更する
sudo su - postgres 
psql

create database test_1;

\c test_1;

create schema api;

create table api.todos (
  id serial primary key,
  done boolean not null default false,
  task text not null,
  due timestamptz
);

insert into api.todos (task) values
  ('finish tutorial 0'), ('pat self on back');

create role web_anon nologin;

grant usage on schema api to web_anon;
grant select on api.todos to web_anon;

PostgRESTの起動用.confを作成
db-uri = "postgres://postgres:Passwd123@localhost:5432/test_1"
db-schemas = "api"
db-anon-role = "web_anon"

db-uri       = "postgres://user:pass@host:5432/dbname" の各意味のドキュメントは

起動
./postgrest tutorial.conf






posted by a23 at 19:14| Comment(0) | PostgreSQL
この記事へのコメント
コメントを書く
お名前: [必須入力]

メールアドレス: [必須入力]

ホームページアドレス: [必須入力]

コメント: [必須入力]

認証コード: [必須入力]


※画像の中の文字を半角で入力してください。