LoginSignup
1
1

More than 5 years have passed since last update.

正式リリース前のBeta版 PostgreSQLをDLして動かす

Last updated at Posted at 2015-11-22

概要

  • 正式リリース前のBeta版PostgreSQLのソースコードをDLして動かす方法の備忘録です

環境

  • CentOS Linux 7 64bit (Mac に VirtualBox で VM環境を建てています)

ソースコード

postgres/postgres
* GitHubの上記リポジトリからソースコードをcloneします
* (上記ページにも書いてあるように、PostgreSQLのオフィシャルリポジトリは別にあり、GitHubはミラーリポジトリです)

インストールパス

  • 今回は以下のパスにインストールします
概要 パス
ソースコードをDLする場所 /usr/local/src/postgres
PostgreSQLをインストールする場所 /usr/local/pgsql

手順

1.リポジトリからソースコードをダウンロード

# cd /usr/local/src/
# git clone https://github.com/postgres/postgres.git postgres

2.Makeファイル作成

基本的な開発環境の構築(まだの場合)

# yum install git gcc zlib-devel bison flex readline-devel openssl-devel

Makefile作成

$ cd postgres
$ ./configure --prefix=/usr/local/pgsql –-enable-depend --enable-debug –-enable-cassert 
$ ls -al | grep Makefile | grep -v grep   #Makefileが作成されたことを確認
  • ./configure --help で各オプションの説明が表示される。以下3つはデバッグ用です。
  • enable-depend ... ヘッダファイルを修正した際に、それに依存する全てのソースファイルもリビルドされるようになります。ソースコードを頻繁にリビルドする場合はつける
  • enable-debug ... デバッグ用情報をつけてコンパイルする
  • enable-cassert ... 各種チェックが走るようになる

3.ソースコードをコンパイル

$ make
$ make check
$ make install

4.DBを初期化

$ /usr/local/pgsql/bin/initdb –encoding=UTF8 –no-locale

5.PostgreSQLを起動

$ pg_ctl -w start 
$ ps aufx | grep postgres | grep -v grep   # 起動したことを確認

6.DBに入って確認

$ /usr/local/pgsql/bin/psql
psql (9.6devel)
Type "help" for help.

postgres=#
  • バージョンに devel(developer) と表示されました。

参考

1
1
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
1