INSTALL
The installation process is composed of 3 basic steps:
- Step 1: Deploy the extension into the host server
- Step 2: Load the extension in the PostgreSQL instance
- Step 3: Create and Initialize the extension inside the database
Two versions are available — stable (production) and latest (new features).
For the list of supported PostgreSQL versions and compatibility, see Support.
There are multiple ways to install the extension :
- Install on RedHat / Rocky Linux
- Install on Fedora
- Install on Debian / Ubuntu
- Install on SUSE
- Install with Ansible
- Install With PGXN
- Install from source
- Install with docker
- Install as a black box
- Install with Django
- Install on MacOS
- Install on Windows
- Install on PostgreSQL Forks
- Install in the cloud
- Load the extension
- Uninstall
Loading and creating the extension is covered on a dedicated page and works the same way whatever the installation method you choose: see Load the extension.
If you're having any problem, check the Troubleshooting section.
Install on RedHat / Rocky Linux / Alma Linux
New RPM repository !
DO NOT use the package provided by the PGDG RPM repository. It is obsolete.
Step 0: Add the DaLibo Labs RPM repository to your system.
sudo dnf install https://yum.dalibo.org/labs/dalibo-labs-4-1.noarch.rpm
Alternatively you can download the latest version from the
Gitlab Package Registry.
Step 1: Deploy
sudo yum install postgresql_anonymizer_16
(Replace 16 with the major version of your PostgreSQL instance.)
Then load the extension to finish the setup.
Install on Fedora
The extension is packaged natively for Fedora, so there is no repository to add.
Step 1: Deploy
sudo dnf install postgresql16-anonymizer
This also pulls in the matching postgresql16-server package. Fedora packages
the extension for PostgreSQL 16 only, under versioned package names; this is
independent of the default PostgreSQL version of your Fedora release (Fedora 44
ships PostgreSQL 18). For another major version, use
our own RPM packages or install
from source.
Note
Fedora ships the version that was current when the release was built, so it may lag behind the latest upstream release. For a more recent version, install our own RPM packages or from source.
Then load the extension to finish the setup.
Install on Debian / Ubuntu
This is the recommended way to install the
stableversion
Step 0: Add the DaLibo Labs DEB Repo to your system.
apt install curl lsb-release
echo deb http://apt.dalibo.org/labs $(lsb_release -cs)-dalibo main > /etc/apt/sources.list.d/dalibo-labs.list
curl -fsSL -o /etc/apt/trusted.gpg.d/dalibo-labs.gpg https://apt.dalibo.org/labs/debian-dalibo.gpg
apt update
Alternatively you can download the latest version from the
Gitlab Package Registry.
Step 1: Deploy
sudo apt install postgresql_anonymizer_16
(Replace 16 with the major version of your PostgreSQL instance.)
Then load the extension to finish the setup.
Install on SUSE
This procedure works with the official PostgreSQL packages from the Postgres Zypper Repository.
Step 0: Download the latest version from the PostgreSQL Anonymizer Package Registry
Rename the downloaded file as postgresql_anonymizer_16.rpm
(Replace 16 with the major version of your PostgreSQL instance.)
Step 1: Deploy
sudo zypper install postgresql_anonymizer_16.rpm
Then load the extension to finish the setup.
Install with Ansible
This method will install the
stableextension
Step 1a: Install the Dalibo PostgreSQL Essential Ansible Collection
ansible-galaxy collection install dalibo.advanced
Step 1b: Write a playbook (e.g. anon.yml) to the postgresql_anonymizer
role to the database servers. For instance:
---
- name: Install the PostgreSQL Anonymizer extension on all hosts of the pgsql group
hosts: pgsql
roles:
- dalibo.advanced.anon
Step 1c: Launch the playbook
ansible-playbook anon.yml
Then load the extension to finish the setup.
Install With PGXN
Warning
This method is not available currently but you can use the "Install From Source" method below which is very similar.
Install From Source
This is the recommended way to install the
latestextension
Important
Building the extension requires a full Rust development environment. It is not recommended to build it on a production server.
Before anything else, you need to install the PGRX System Requirements and install and initialise PGRX itself using
cargo install cargo-pgrx --version 0.14.3 --locked
cargo pgrx init
Note
You may need to specify your pg_config location in the second command
by using the --pg{version} flag
(e.g. --pg16 /usr/lib/postgresql/16/bin/pg_config).
Step 0: Download the source from the
official repository on Gitlab,
either the archive of the latest release,
or clone the latest branch:
git clone https://gitlab.com/dalibo/postgresql_anonymizer.git
Step 1: Build the project like any other PostgreSQL extension:
make extension
sudo make install
NOTE: If you have multiple versions of PostgreSQL on the server or if the
package does not build/install correctly, you may
need to specify which version is your target by defining the PG_CONFIG and
PGVER env variable like this:
make extension PG_CONFIG=/usr/lib/postgresql/14/bin/pg_config PGVER=pg14
sudo make install PG_CONFIG=/usr/lib/postgresql/14/bin/pg_config PGVER=pg14
Then load the extension to finish the setup.
Install with Docker
If you can't (or don't want to) install the PostgreSQL Anonymizer extension directly inside your instance, then you can use the docker image :
docker pull registry.gitlab.com/dalibo/postgresql_anonymizer:stable
The image is available with 2 two tags:
latest(default) contains the current developmentsstableis the based on the previous release
You can run the docker image like the regular postgres docker image.
For example:
Launch a postgres docker container
docker run -d -e POSTGRES_PASSWORD=x -p 6543:5432 registry.gitlab.com/dalibo/postgresql_anonymizer
then connect:
export PGPASSWORD=x
psql --host=localhost --port=6543 --user=postgres
The extension is already created and initialized, you can use it directly:
# SELECT anon.partial_email('daamien@gmail.com');
partial_email
-----------------------
da******@gm******.com
(1 row)
Note: The docker image is based on the latest PostgreSQL version and we do not plan to provide a docker image for each version of PostgreSQL. However you can build your own image based on the version you need like this:
DOCKER_PG_MAJOR_VERSION=16 make docker_image
Install as a "Black Box"
see Anonymous Dumps
Install With Django
Django PostgreSQL Anonymizer provides seamless integration with the PostgreSQL Anonymizer extension, enabling you to anonymize data at the database level with zero performance overhead. Ideal for development workflows, safe data sharing, and reducing privacy risks.
See https://django-postgres-anonymizer.readthedocs.io/
Install on MacOS
WE DO NOT PROVIDE COMMUNITY SUPPORT FOR THIS EXTENSION ON MACOS SYSTEMS.
However it should be possible to build the extension if you install the PGRX Mac OS system requirements and then follow the regular install from source procedure.
Install on Windows
At the moment there's no native build of PostgreSQL Anonymizer for Windows.
However it is possible to run PostgreSQL inside a WSL2 container, which is basically an Ubuntu subsystem running on Windows. You can then install PostgreSQL Anonymizer inside the WSL2 container like you would on a regular Ubuntu server.
Please read the Windows documentation for more details:
If you need native builds for Windows, please consider sponsoring the project !
Install on PostgreSQL Forks
The extension is also available for PostgreSQL forks and PostgreSQL-compatible software, such as:
Please refer to their own documentation on how to activate the extension as they might have a platform-specific install procedure.
Install in the cloud
This extension must be installed with superuser privileges, which is something that most Database As A Service platforms (DBaaS), such as Amazon RDS or Microsoft Azure SQL, do not allow. They must add the extension to their catalog in order for you to use it.
At the time we are writing this (Jan. 2026), the following platforms provide PostgreSQL Anonymizer:
- Aiven
- Alibaba Cloud
- Crunchy Bridge
- Google Cloud SQL
- IBM Cloud
- Microsoft Azure Database
- Neon
- Postgres.ai
- Scalingo
- Yandex
Please refer to their own documentation on how to activate the extension as they might have a platform-specific install procedure.
If your favorite DBaaS provider is not present in the list above, there is not much we can do about it... Although we have open discussions with most major actors in this domain, we DO NOT have internal knowledge on whether or not they will support it in the near future. If privacy and anonymity are a concern to you, we encourage you to contact the customer service of these platforms and ask them directly if they plan to add this extension to their catalog.
Addendum: Troubleshooting
If you are having difficulties, you may have missed a step during the installation processes. Here's a quick checklist to help you:
Check that the extension is present
First, let's see if the extension was correctly deployed:
ls $(pg_config --sharedir)/extension/anon
ls $(pg_config --pkglibdir)/anon.so
If you get an error, the extension is probably not present on host server. Go back to step 1.
Check that the extension is loaded
Now connect to your database and look at the configuration with:
SHOW shared_preload_libraries;
SHOW session_preload_libraries;
SHOW local_preload_libraries;
If you don't see anon in any of these parameters, go back to step 2.
Check that the extension is created
Again connect to your database and type:
SELECT * FROM pg_extension WHERE extname= 'anon';
If the result is empty, the extension is not declared in your database. Go back to step 3.
Check that the extension is initialized
Finally, look at the state of the extension:
SELECT anon.is_initialized();
If the result is not t, the extension data is not present.
Go back to step 3.
Uninstall
Step 1: Remove all rules
SELECT anon.remove_masks_for_all_columns();
SELECT anon.remove_masks_for_all_roles();
Although this step is not mandatory, it is highly recommended.
In some situations ever, it may be useful to keep the masking rules inside
the database schema even if the anon extension is removed ! Keep in mind
that pg_dump and pg_restore both have an option --no-security-labels
to exclude the masking rules when you want to import/export the database.
Step 2: Drop the extension
DROP EXTENSION anon;
Step 3: Unload the extension
Reverse the load step. If you preloaded anon globally with
shared_preload_libraries:
ALTER SYSTEM RESET shared_preload_libraries;
then restart PostgreSQL. If you loaded it per-database instead:
ALTER DATABASE foo RESET session_preload_libraries;
Step 4: Uninstall the extension
For Redhat / Rocky:
sudo yum remove postgresql_anonymizer_17
Replace 17 by the version of your postgresql instance.