(Last Updated On: October 29, 2018)

Monica is an open source web-based Personal Relationship Manager
application to organize the interactions with your loved ones. You can think of PRM as a CRM that helps you keep track of everything that’s important about their friends and family. This application is for people who have a hard time remembering details about other people’s lives – especially the ones they care about.

In this guide, we’ll see how you can install and use Monica PRM on Ubuntu 18.04 LTS system.

Monica PRM Principles

  • It should help have better relationships.
  • It should be simple to use, simple to contribute to, simple to understand, extremely simple to maintain.
  • It is not a social network and shall never be.
  • It is not and will never be ad-supported.
  • Users are not and will never be tracked.
  • It should be transparent.
  • It should be open-source.
  • It should do one thing (documenting social interactions) extremely well, and nothing more.
  • It should be well documented.

Features of Monica Personal Relationship Manager

The features of Monica PRM as stated on Github page are:

  • Add and manage contacts
  • Define relationships between contacts
  • Reminders
  • Auto reminders for birthdays
  • Stay in touch with a contact by sending reminders at a given interval
  • Management of debts
  • Ability to add notes to a contact
  • Ability to indicate how you’ve met someone
  • Management of activities done with a contact
  • Management of tasks
  • Management of gifts
  • Management of addresses and all the different ways to contact someone
  • Management of contact field types
  • Management of contact pets
  • Basic journal
  • Ability to indicate how the day went
  • Export and import of data
  • Export a contact as vCard
  • Ability to set custom genders
  • Ability to define custom activity types
  • Ability to favorite contacts
  • Track conversations made on social media or SMS
  • Multi-users
  • Labels to organize contacts
  • Ability to define what section should appear on the contact sheet
  • Multi-currencies
  • Multi-languages
  • An API that covers most of the data
  • We also have official mobile apps, also open source

Monical setup Requirements

  • PHP 7.1+ or newer
  • HTTP server with PHP support (eg: Apache, Nginx, Caddy)
  • Composer
  • Git
  • MySQL Database

Install Monica Personal Relationship Manager(PRM) on Ubuntu 18.04 LTS

This section will cover installation of Monica PRM dependencies and deployment of the actual application on your Ubuntu 18.04 LTS server.

Step 1: Install PHP and Composer

Start by installing PHP 7.2 on Ubuntu and compose dependency manager for PHP

sudo apt install -y git php php-intl php-json php-cli php-fpm php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath

When done, install composer

sudo apt -y install composer

Step 2: Install MariaDB

Install MariaDB using the guide:

Install MariaDB 10.3 on Ubuntu 18.04 and CentOS 7

Once MariaDB service is running, log in with the root account to configure the database.

$ mysql -uroot -p

CREATE DATABASE monica;
CREATE USER 'monica'@'localhost' IDENTIFIED BY 'StrongPassword';
GRANT ALL ON monica.* TO 'monica'@'localhost';
FLUSH PRIVILEGES;
exit

Step 3: Download and Configure Monica PRM

Now download Monica fro Github and configure it.

cd /srv
git clone https://github.com/monicahq/monica.git
cd monica

Create environment variable file and modify .env variables to your specific needs.

APP_URL=http://prm.example.com
DB_DATABASE=monica
DB_USERNAME=monica
DB_PASSWORD=StrongPassword

Install all PHP packages by running:

composer install --no-interaction --no-suggest --no-dev

Generate an application key and set APP_KEY with the right value automatically.

php artisan key:generate

Run the migrations, seed the database and symlink folders:

$ php artisan setup:production
You are about to setup and configure Monica. Do you wish to continue? (yes/no) [no]:
> yes
-----------------------------
|
| Welcome to Monica v2.9.0
|
-----------------------------
| You can now register to the first account by opening the application:
| URL:      http://prm.example.com
-----------------------------
Setup is done. Have fun.

Finally, create the access tokens required for the API (Optional).

$ php artisan passport:install
Encryption keys generated successfully.
Personal access client created successfully.
Client ID: 1
Client Secret: DpJ3uuf67tceR2V7Jl1ljLOfv80e3kM1DfWBACs4
Password grant client created successfully.
Client ID: 2
Client Secret: kWzG5MDdOThWYgSDnCiiYZzxdasmzGiPFOijI3dK

Step 4: Configure a cron job

Monica requires some background processes to continuously run, setup a cron that runs every minute to trigger the command php artisan schedule:run.

echo "* * * * * www-data /usr/bin/php /var/www/html/monica/artisan schedule:run" | sudo tee  /etc/cron.d/monica

Step 5: Configure Apache web server

Install Apache web server by running:

sudo apt install apache2  libapache2-mod-php

Enable the rewrite module of the Apache web server:

sudo a2enmod rewrite
sudo systemctl restart apache2

Configure a new Monica Virtual Host site in apache by doing:

sudo vim /etc/apache2/sites-enabled/monica.conf

Populate the file with data:

<VirtualHost *:80>
    ServerName prm.example.com

    ServerAdmin [email protected]
    DocumentRoot /srv/monica/public

    <Directory /srv/monica/public>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog /var/log/apache2/monica_error.log
    CustomLog /var/log/apache2/monica_access.log combined
</VirtualHost>

Set proper permissions for Web directory

sudo chown -R www-data:www-data /srv/monica
sudo chmod -R 775 /srv/monica/storage

Check apache configuration syntax then restart Apache web service

$ sudo apachectl -t
Syntax OK
$ sudo systemctl restart apache2

The final step is to access Monica web interface on http://prm.example.com. You’ll be required to create admin user on first access:

After clicking the Register button, you’ll get a welcome page

You should be ready to add your Friends and family members contacts.

Thanks for using our guide to install Monica Personal Relationship Manager on Ubuntu 18.04 LTS. I hope this tool helps you keep in touch with old friends and have a balanced job/family time.