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.1/ (stored 0%) adding: pgmemento-0.7.1/sql/ (stored 0%) adding: pgmemento-0.7.1/sql/pgmemento.sql (deflated 82%) adding: pgmemento-0.7.1/sql/pgmemento--0.7--0.7.1.sql (deflated 70%) adding: pgmemento-0.7.1/META.json (deflated 63%) adding: pgmemento-0.7.1/test/ (stored 0%) adding: pgmemento-0.7.1/doc/ (stored 0%) adding: pgmemento-0.7.1/doc/README.pgmemento (deflated 49%) adding: pgmemento-0.7.1/doc/LICENSE.pgmemento (deflated 66%) adding: pgmemento-0.7.1/doc/pgmemento-docs-0.7.1/ (stored 0%) adding: pgmemento-0.7.1/pgmemento.control (deflated 30%) adding: pgmemento-0.7.1/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.1` directory and run: `make && sudo make install` pgMemento should now be installed in your PostgreSQL. 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.1 | 72 ``` `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.