By default, Fedora comes configured to write binary resources (i.e. files) to the file system and RDF resources (i.e. objects) to a database. For testing, a file-based objects database may be useful. However, for production installations, it is recommended to use a MySQL or PostgresSQL object store. Below are the steps to use MySQL or PostgreSQL.

MySQL

  1. Install an instance of MySQL and create a database called fcrepo and a user account that can access it
  2. Run Fedora with the following JAVA_OPTS:


JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshape.configuration=classpath:/config/jdbc-mysql/repository.json"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.mysql.username=<username>"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.mysql.password=<password>"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.mysql.host=<default=localhost>"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.mysql.port=<default=3306>"


Note, the fcrepo database must be manually created, but the tables will be automatically created.

PostgreSQL

  1. Install an instance of PostgreSQL and create a database called fcrepo and a user account that can access it
  2. Run Fedora with the following JAVA_OPTS:
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshape.configuration=classpath:/config/jdbc-postgresql/repository.json"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.postgresql.username=<username>"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.postgresql.password=<password>"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.postgresql.host=<default=localhost>"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.postgresql.port=<default=5432>"

Note, the fcrepo database must be manually created, but the tables will be automatically created.

Database Setup

MySQL

To create a new database and user in MySQL, assuming a username of user1 and a password of xyz:

$ mysql -u root -p
> create database fcrepo;
> create user 'user1'@'localhost' IDENTIFIED BY 'xyz';
> GRANT ALL PRIVILEGES ON fcrepo.* to 'user1'@'localhost';
> \q

PostgreSQL

To create a new database and user in PostgreSQL, assuming a username of user1 and a password of xyz:

$ sudo -u postgres psql
> create database fcrepo;
> create user user1;
> alter user user1 password 'xyz';
> grant all privileges on database fcrepo to user1;
> \q