1. Home
  2. Linux
  3. Ubuntu
  4. How to install Monica on Ubuntu 16.04

How to install Monica on Ubuntu 16.04

How to install Monica on Ubuntu 16.04
How to install Monica on Ubuntu 16.04

In this tutorial we will teach you how to install Monica on Ubuntu 16.04 VPS.
Monica is a Personal Relationship Management (PRM) system made in Laravel framework. It was built and designed specifically to help you have a bigger and meaningful relationship with your friends and family and to also help you keep track of every important detail about your friends and family.


Monica requires the following:

  • PHP 7.0+
  • MySQL, SQLite or Postgre
  • Git
  • Composer

To begin, login to your server via SSH as user root.


Next, update the system and install the required packages.

apt-get update && apt-get upgrade
apt install apache2 php7.0 php7.0-mysql php7.0-xml php7.0-intl php7.0-mbstring git curl

Install PHP along with several dependencies.

apt-get install php7.0 php7.0-intl php7.0-curl php7.0-zip

Now Install MySQL on the VPS.

apt-get install mysql-server

After the installation is done, execute the ‘mysql_secure_installation’ script to secure your MySQL server

Enter current password for root (enter for none): ENTER
Set root password? [Y/n] Y
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

Create a fresh MySQL user and database for Monica with the commands below.

mysql -u root -p
mysql> CREATE DATABASE monica;
mysql> GRANT ALL PRIVILEGES ON monica.* TO 'monicauser'@'localhost' IDENTIFIED BY 'YOURPASSWORD';
mysql> \q

Reminder to swap ‘YOURPASSWORD’ with an actual strong password of your choosing.

Duplicate the Monica git repository.

mkdir /var/www/html/monica
git clone https://github.com/monicahq/monica.git /var/www/html/monica/

Swap the permissions of the Monica directory.

chown -R www-data:www-data /var/www/html/monica

Install ‘nodejs’ which is required for ‘npm’.

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
apt-get install -y nodejs

Now, you must install Composer, which you can do with the following.

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

After this is done, run composer in the directory the repository has been cloned in order to install Monica’s dependencies.

cd /var/www/html/monica

composer install
Create ‘.env’ file with the example given and update it with your information.

cp .env.example .env

Execute the command below to generate an application key. It should set ‘APP_KEY’ with the correct value automatically.

php artisan key:generate
Application key [base64:j8RgNwHGsqir1ovhDWXYlEa6P2ODNBwRGMaQTm4ZBTs=] set successfully.

Run every migration by executing the command below.

php artisan migrate

Enable avatar uploads for the contacts made in Monica.

php artisan storage:link
The [public/storage] directory has been linked.
Increase the activity types and countries table
php artisan db:seed --class ActivityTypesTableSeeder
php artisan db:seed --class CountriesSeederTable

To make the reminders work correctly, you will need to set a cronjob which executes each minute with the command below.

php artisan schedule:run

After Monica is successfully installed on your server, you may access it at with ‘http://yourIPaddress/monica

Updated on December 23, 2018

Was this article helpful?

Related Articles

Leave a Comment

[apsl-login-lite login_text='Please login with a social account']