Install from source

This document describes how to build and install PGroonga from source.

Build and install instruction is different between on Windows and on non Windows. This document describes it separately.

On non Windows

Install PostgreSQL.

Install Groonga. We recommend that you use package. If you use package to install Groonga, install the following package:

Extract PGroonga source:

% wget http://packages.groonga.org/source/pgroonga/pgroonga-1.1.9.tar.gz
% tar xvf pgroonga-1.1.9.tar.gz
% cd pgroonga-1.1.9

FYI: If you want to use the unreleased latest version, use the followings:

% git clone --recursive https://github.com/pgroonga/pgroonga.git
% cd pgroonga

Build PGroonga. There are some options:

Use the following command line when you want to build with WAL support:

% make HAVE_MSGPACK=1

Use the following command line when you don't need WAL support:

% make

If you get any error, confirm the followings:

If pg_config command doesn't exist, you may forget to install the development package of PostgreSQL.

If pkg-config --list-all doesn't include groonga, you may forget to install the development package of Groonga. Or groonga.pc is installed into non-standard directory. You can use PKG_CONFIG_PATH environment variable for the case.

Here is an example when you install Groonga with --prefix=/usr/local:

% PKG_CONFIG_PATH=/usr/local/lib/pkg-config make

Install PGroonga:

% sudo make install

Create a database:

% psql --command 'CREATE DATABASE pgroonga_test'

(Normally, you should create a user for pgroonga_test database and use the user. See GRANT USAGE ON SCHEMA pgroonga for details.)

Connect to the created database and execute CREATE EXTENSION pgroonga:

% psql -d pgroonga_test --command 'CREATE EXTENSION pgroonga;'

That's all!

Try tutorial. You can understand more about PGroonga.

On Windows

Here is a list of required software to build and install PGroonga from source. Install them:

Download PGroonga source archive for Windows from packages.groonga.org. Source archive for Windows is zip file. Source archive for Windows bundles Groonga.

Extract the downloaded source archive and move to source folder:

> cd c:\Users\%USERNAME%\Downloads\pgroonga-1.1.9

Specify build option by cmake. The following command line is for building PGroonga for 64bit version PostgreSQL. If you want to build for 32bit version PostgreSQL, use -G "Visual Studio 12 2013" parameter instead:

pgroonga-1.1.9> cmake . -G "Visual Studio 12 2013 Win64" -DCMAKE_INSTALL_PREFIX=%POSTGRESQL_INSTALL_FOLDER% -DGRN_WITH_BUNDLED_LZ4=yes -DGRN_WITH_BUNDLED_MECAB=yes -DGRN_WITH_BUNDLED_MESSAGE_PACK=yes -DGRN_WITH_MRUBY=yes

If you installed PostgreSQL by installer, %POSTGRESQL_INSTALL_FOLDER% is C:\Program Files\PostgreSQL\%POSTGRESQL_VERSION%.

If you installed PostgreSQL by zip, %POSTGRESQL_INSTALL_FOLDER% is %POSTGRESQL_ZIP_EXTRACTED_FOLDER%\pgsql.

Build PGroonga:

pgroonga-1.1.9> cmake --build . --config Release

Install PGroonga. You may be required administrator privilege. For example, you installed PostgreSQL by installer, you will be required administrator privilege.

pgroonga-1.1.9> cmake --build . --config Release --target Install

Create a database:

postgres=# CREATE DATABASE pgroonga_test;

(Normally, you should create a user for pgroonga_test database and use the user. See GRANT USAGE ON SCHEMA pgroonga for details.)

Connect to the created database and execute CREATE EXTENSION pgroonga:

postgres=# \c pgroonga_test
pgroonga_test=# CREATE EXTENSION pgroonga;

That's all!

Try tutorial. You can understand more about PGroonga.