How to Install Monica Personal Relationship Manager on CentOS 8

monica 1

How to Install Monica Personal Relationship Manager on CentOS 8

Monica is an open-source Personal Relationship Management (PRM) web application designed to organize interactions with your loved ones. Think of it as a CRM (a popular tool used by sales teams in the corporate world) for your friends or family. Monica allows people to keep track of everything important about their friends and family. Like the activities that are done with them. When you last called someone. What you talked about. It will help you remember the name and the age of the kids. It can also remind you to call someone you haven’t talked to in a while. This tutorial will go over Monica installation on CentOS 8.


  • 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
  • Upload documents and photos
  • Export and import of data
  • Export 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


  • CentOS 8
  • Git
  • NPM (Node Package Manager)
  • PHP version 7.1 or newer
  • MySQL
  • HTTP server with PHP support (eg: Apache, Nginx, Caddy…)
  • Composer
  • Optional: Redis or Beanstalk


  • A CentOS 8 operating system.
  • A non-root user with sudo privileges.

Initial steps

Check your CentOS version:

cat /etc/centos-release
# CentOS Linux release 8.0.1905 (Core)

Set up the timezone:
timedatectl list-timezones
sudo timedatectl set-timezone 'Region/City'

Update your operating system packages (software). This is an important first step because it ensures you have the latest updates and security fixes for your operating system’s default software packages:
sudo yum update -y

Install some essential packages that are necessary for basic administration of the CentOS operating system:
sudo yum install -y curl wget vim git unzip socat bash-completion epel-release gcc-c++ make libpng-devel

Step 1 – Install PHP

Install PHP, as well as the required PHP extensions:
sudo yum install -y php php-cli php-fpm php-common php-mbstring php-xml php-mysqlnd php-curl php-zip php-intl php-bcmath php-gd php-json php-gmp

To show PHP compiled in modules, you can run:
php -m

. . .
. . .

Check the PHP version:
php --version

# PHP 7.2.11-1-(cli) (built: Oct 26 2019 14:14:18) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies
# with Zend OPcache v7.3.11-1~deb10u1, Copyright (c) 1999-2018, by Zend Technologies

Start and enable PHP-FPM service:
sudo systemctl start php-fpm.service
sudo systemctl enable php-fpm.service

Step 2 – Install acme.sh client and obtain Let’s Encrypt certificate ( optional )

Securing your site with HTTPS is not necessary, but it is a good practice to secure your site traffic. To obtain a TLS certificate from Let’s Encrypt we will use acme.sh client. Acme.sh is a simple UNIX shell software for obtaining TLS certificates from Let’s Encrypt with zero dependencies.

Download and install acme.sh:
sudo su - root
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
./acme.sh --install --accountemail [email protected]
source ~/.bashrc
cd ~

Check acme.sh version:
acme.sh --version
# v2.8.2

Obtain RSA and ECC/ECDSA certificates for your domain/hostname:

# RSA 2048
acme.sh --issue --standalone -d example.com --keylength 2048
acme.sh --issue --standalone -d example.com --keylength ec-256

If you want fake certificates for testing, you can add --staging flag to the above commands.

After running the above commands, your certificates and keys will be in:

  • For RSA: /home/username/example.com directory.
  • For ECC/ECDSA: /home/username/example.com_ecc directory.

To list your issued certs you can run:
acme.sh --list

Create a directory to store your certs. We will use the /etc/letsencrypt directory.
mkdir -p /etc/letsecnrypt/example.com
sudo mkdir -p /etc/letsencrypt/example.com_ecc

Install/copy certificates to /etc/letsencrypt directory.
acme.sh --install-cert -d example.com --cert-file /etc/letsencrypt/example.com/cert.pem --key-file /etc/letsencrypt/example.com/private.key --fullchain-file /etc/letsencrypt/example.com/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"
acme.sh --install-cert -d example.com --ecc --cert-file /etc/letsencrypt/example.com_ecc/cert.pem --key-file /etc/letsencrypt/example.com_ecc/private.key --fullchain-file /etc/letsencrypt/example.com_ecc/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"

All the certificates will be automatically renewed every 60 days.

After obtaining certs exit from root user and return to regular sudo user:

Step 3 – Install MariaDB and create a database for Monica

Install MariaDB database server:
sudo yum install -y mariadb-server

Check the MariaDB version:
mysql --version
# mysql  Ver 15.1 Distrib 10.3.17-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Start and enable MariaDB service:
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Run mysql_secure installation script to improve MariaDB security and set the password for MariaDB root user:
sudo mysql_secure_installation

Answer each of the questions:
Would you like to setup VALIDATE PASSWORD plugin? N
New password: your_secure_password
Re-enter new password: your_secure_password
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Connect to MariaDB shell as the root user:
sudo mysql -u root -p
# Enter password

Create an empty MariaDB database and user for Monica and remember the credentials:
mariadb> CREATE DATABASE dbname;
mariadb> GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';

Exit from MariaDB:
mariadb> exit

Replace dbname, username and password with your names.

Step 4 – Install and configure NGINX

Monica will work fine with most major web server software with PHP support, but in this guide, we will use NGINX. Feel free to use Apache if you prefer it over NGINX.

Install NGINX:
sudo yum install -y nginx

Check the NGINX version:
sudo nginx -v
# nginx version: nginx/1.14.2

Run sudo vim /etc/nginx/conf.d/monica.conf command and configure NGINX for Monica.
server {
listen 80;
listen 443 ssl;

server_name example.com;
root /var/www/monica/public/;
ssl_certificate /etc/letsencrypt/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com/private.key;
ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/private.key;
index index.php;
charset utf-8;

location ^~ /storage {
deny all;

location / {
try_files $uri $uri/ /index.php?$query_string;

location ~* .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
include fastcgi_params;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;

Test NGINX configuration:
sudo nginx -t

Reload NGINX:
sudo systemctl reload nginx.service

Step 5 – Install Node.js and npm

Install Node.js:
curl --silent --location https://rpm.nodesource.com/setup_12.x | sudo bash -
sudo yum install -y nodejs

Check Node.js and npm versions:
node -v && npm -v
# v12.13.1
# 6.12.1

Step 6 – Install Composer

Install Composer:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer

Check the Composer version:
composer --version
# Composer version 1.9.1 2019-11-01 17:20:17

Step 7 – Install and configure Monica

Create an empty document root folder where Monica should be installed:
sudo mkdir -p /var/www/monica

Navigate to the document root folder:
cd /var/www/monica

Change ownership of /var/www/monica folder to user johndoe:

Don’t forget to replace “johndoe” with your username.
sudo chown -R johndoe:johndoe /var/www/monica

Clone Monica repository to it:
git clone https://github.com/monicahq/monica.git .
git checkout tags/v2.15.2

NOTE: Check out to a tagged version of Monica since the master branch may not always be stable. Find the latest official version on the releases page on Github and update it to the above version number to the latest release.

To create your version of all the environment variables needed for the project to work run:
cp .env.example .env

Update .env to your specific needs. Don’t forget to set DB_USERNAME and DB_PASSWORD with the settings used behind. You’ll need to configure a mail server for registration and reminders to work correctly.

Run composer install --no-interaction --no-suggest --no-dev to install all packages.

Run php artisan key:generate to generate an application key. This will set APP_KEY with the right value automatically.

Run php artisan setup:production -v to run the migrations, seed the database and symlink folders.

Set the appropriate ownership and permissions:
sudo chown -R nginx:nginx /var/www/monica
sudo chmod -R 775 /var/www/monica/storage

Run sudo vim /etc/php-fpm.d/www.conf and set user and group to nginx. Initially, it will be set to user and group apache.
sudo vim /etc/php-fpm.d/www.conf

Restart php-fpm.service:
sudo systemctl restart php-fpm.service

Step 8 – Complete the Monica installation

Now, open your web browser and type the URL http://example.com. You will be redirected to the following page:

Create an account

Provide your email address, name, and password. Then, click on the Register button. You should see the Monica dashboard in the following page:

Monica PRM login

Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !