How to install the Monica Personal Information Management Cloud on Ubuntu 18.04

Keep better track of relationships with the open source cloud/web-based Monica.

datahero.jpg
Image: Jack Wallen

Monica is an open source web/cloud-based Personal Relationship Manager that can easily serve as a means to organize information about clients, friends, family, leads, etc. If you're looking for a web-based tool that will enable you to keep track of the details about people (regardless of their relationship to you), Monica might be what you need.

I'm going to walk you installing Monica on Ubuntu 18.04. The installation is a bit tricky, so be prepared to do a bit of work. With that said, let's install.

SEE: Vendor comparison: Microsoft Azure, Amazon AWS, and Google Cloud (Tech Pro Research)

What you need

The only things you need are a working installation of Ubuntu Server 18.04 and an account with sudo privileges. With those in place, let's install.

Installing dependencies

The first thing we must do is take care of a number of dependencies. Open a terminal window and issue the following command:

sudo apt-get install 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 -y

Once that command completes, install composer with the command:

sudo apt-get install composer -y

Next, we'll install the LAMP stack with the command:

sudo apt-get install lamp-server^ -y

When that completes, secure the MySQL installation by issuing the command:

sudo mysql_secure_installation

Answer all of the questions (and create an admin account password). When that completes, you're ready to move on.

Creating a database and user

Now lets create the necessary database and user. Issue the command:

mysql -u root -p

When prompted, type the MySQL admin account password you created earlier. Create the database and user (as well as give the user the necessary permissions) with the commands:

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

where password is a strong and unique password.

Download and configure Monica

Change into the document root with the command:

sudo mkdir monica

Create a new directory with the command:

sudo mkdir monica

Clone Monica with the following commands:

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

Copy the configuration file with the command:

sudo cp .env.example .env

Open the .env file with the command:

sudo nano .env

Look for (and change accordingly) the following lines:

APP_URL=SERVER_IP
DB_DATABASE=monica
DB_USERNAME=monica
DB_PASSWORD=password

where SERVER_IP is the IP (or domain) of the server and password is the password you created for the database.

Save and close that file.

Install the php packages with the command:

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

Generate an application key with the command:

php artisan key:generate

Finally, run the migration and seed the database/symlink folders with the command:

php artisan setup:production

When that command completes, it will indicate where you can point a browser. Hold up; you're not ready for that just yet. Before you do this, create a new cron job (because Monica requires a few commands to be run every few minutes) with the command:

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

Finally, enable rewrite with the command:

sudo a2enmod rewrite

Configure Apache

The next step is to tell Apache where the Monica files are. Create a new configuration file with the command:

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

In that file, paste the following:

<VirtualHost *:80>
    ServerName SERVER_IP/DOMAIN

    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/html/monica/public

    <Directory /var/www/html/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>

where SERVER_IP/DOMAIN is either the IP address or domain of the server.

Save and close that file.

Set the proper permissions for the Monica web folder with the commands:

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

Restart Apache with the command:

sudo systemctl restart apache

Finally, open a browser and point it to http://SERVER_IP (where SERVER_IP is the IP address of the server). You will be prompted to create an account with Monica (Figure A). Once you create an account, you can log in.

Figure A

Figure A

Registering a Monica account.


You are now ready to add your contacts to Monica. Once you add a contact, you can start filling in all the details you need (such as conversations, phone calls, activities, reminders, tasks, gifts, and much more) to better keep track of those relationships.

Also see

By Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.