As pgMemento is written entirely in SQL and PL/pgSQL it's sufficient to run all scripts from the `src` folder to install it. A new schema will appear in your database called `pgmemento`. The provided `INSTALL_PGMEMENTO.sql` script also adds the schema to your database's `search_path`. `psql -h localhost -p 5432 -U my_user -d my_database -f INSTALL_PGMEMENTO.sql` The script should end with the message "pgMemento setup completed!". ## Build as extension Since v0.7 pgMemento can also be installed as an extension into your databases. But first, you have to build the extension. To do so, open a shell environment and change to the `extension/pgxn` directory. Make the `build.sh` script executable with `chmod +x` and run it. The output should look like this: ``` Copying the control file ... done Preparing the filesystem structure ... done Compiling the extension SQL ... done Copying the documentation ... done Building the archive ... adding: pgmemento-0.7.3/ (stored 0%) adding: pgmemento-0.7.3/sql/ (stored 0%) adding: pgmemento-0.7.3/sql/pgmemento--0.7--0.7.3.sql (deflated 80%) adding: pgmemento-0.7.3/sql/pgmemento--0.7.2--0.7.3.sql (deflated 80%) adding: pgmemento-0.7.3/sql/pgmemento--0.7.1--0.7.3.sql (deflated 80%) adding: pgmemento-0.7.3/sql/pgmemento.sql (deflated 82%) adding: pgmemento-0.7.3/Makefile (deflated 46%) adding: pgmemento-0.7.3/META.json (deflated 63%) adding: pgmemento-0.7.3/pgmemento.control (deflated 30%) adding: pgmemento-0.7.3/doc/ (stored 0%) adding: pgmemento-0.7.3/doc/LICENSE.pgmemento (deflated 66%) adding: pgmemento-0.7.3/doc/pgmemento-docs-0.7.3/ (stored 0%) adding: pgmemento-0.7.3/pgmemento.control (deflated 30%) adding: pgmemento-0.7.3/Makefile (deflated 46%) done ``` pgMemento is now bundled in a zip file within the newly created `dist` directory within the same folder. ## Install the extension Change to the `dist` folder and unzip the archive. Change to the unpacked `pgmemento-0.7.3` directory and run: `make && sudo make install` pgMemento should now be installed in your PostgreSQL. If not, it can be you have to run `make install` once again. You can connect to any DB and check the `pg_available_extensions` system view: `SELECT * FROM pg_available_extensions WHERE name = 'pgmemento';` If pgMemento is listed there you are now able to run: `CREATE EXTENSION pgmemento;` ## Check the pgMemento version To check which version of pgMemento you have just installed run the following command: ```sql SELECT full_version, build_id FROM pgmemento.version(); full_version | build_id -----------------+---------- pgMemento 0.7.3 | 93 ``` `build_id` refers to the pull request number, to make it easy to track which changes are included. It might change in the future to the commit hash.