Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

PostgreSQLをローカルにインストールする

More than 3 years have passed since last update.

最近のPostgreSQLはJSONに対応したそうですね!
でももうサービスで入っててバージョンあげたくないよ!
よし、ローカルにいれて試そう!

今回は/home/ubuntu/workspace/user/にポート20000で建てるよ!出力は略すね!ごめんよ!

$ cd /home/ubuntu/workspace/user/
$ wget https://ftp.postgresql.org/pub/source/v9.6.2/postgresql-9.6.2.tar.gz
$ tar xvzf postgresql-9.6.2.tar.gz
$ cd postgresql-9.6.2/
$ ./configure --prefix=/home/ubuntu/workspace/user/
$ make
$ make install
$ cd ..
$ bin/initdb data
$ bin/pg_ctl -D data -o "-p 20000" start
server starting
$ bin/createdb test -p 20000 
$ bin/psql test -p 20000
psql (9.6.2)
Type "help" for help.

test=# 

よし!動いた!軽くJSONしてみようか?

test=# select '{ "aa": 12 }'::jsonb;

   jsonb    

{"aa": 12}
(1 row)

test=# \q
$ 

うん、動いてるね!!やった!

じゃあ遊ぶのは今度にしてDB止めようか!

 $ bin/pg_ctl -D data stop

またね!

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away