LoginSignup
1
2

More than 5 years have passed since last update.

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

Posted at

最近の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

またね!

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2