GeoNetwork needs a DB for storing its internal data.
We will create a DB in PostgreSQL on the local machine.
If you plan to have GeoNetwork use an external DB, you can skip this section (Internal database); please do read next section anyway (Spatial index).
As user root, switch to user postgres:
su - postgres
Create a PostgreSQL DB for GeoNetwork:
createuser -S -D -R -P -l geonetwork
Annotate the user password.
Create the DB:
createdb -O geonetwork geonetwork -E utf-8
Add the spatial extension to the geonetwork DB:
psql geonetwork
GeoNetwork uses different index tecniques for indexing the metadata. In particular, it uses GeoTools datastores for creating spatial indices.
If you have a spatially enabled DBMS (such as PostGIS or Oracle Spatial) you may create a DB for creating a datastore that will be used as a spatial index. If no DB is available, a shapefile will be created on the filesystem for storing the spatial info; this may be a proper solution for demo or small installations, but its performance will decrease as the number of metadata in the catalog grows.
You have different options:
When planning your DB architecture, please note that the internal DB will need a periodic backup, while the DB used for indices can be recreated on the fly.
Note
This is an optional step, read the section above!
Create the DB that will contain the spatial index only. As user root, switch to user postgres:
su - postgres
and create the new DB
createdb -O geonetwork gn_spatial -E utf-8
In order to add the spatial extension in your postgres DB you need to have superuser privileges on the DB. As user root, switch to user postgres:
su - postgres
Then connect to the DB you will be using for the spatial indices, either
Then add the postgis extensions
CREATE EXTENSION postgis;
CREATE EXTENSION "postgis_topology";
GRANT ALL PRIVILEGES ON DATABASE geonetwork TO geonetwork;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO geonetwork;
In a later section we’ll tell GeoNetwork how to use these DBs.