How to Install and Set Up Monica

By Arslan Ud Din Shafiq, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

Monica is an easy-to-use, open source web based personal management system. Developed in Laravel PHP framework, Monica allows you to organize, manage and track the interactions with your contacts in a centralized place. You can also easily import or export your contacts by using Monica’s REST API.

In this tutorial, we will be installing and setting up Monica using Alibaba Cloud Elastic Compute Service (ECS) with Ubuntu 16.04 installed.

Prerequisites

  1. You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you are a new user, you can get a free account in your Alibaba Cloud account. If you don’t know about how to setup your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 1.5GB RAM and 1 Core processor.
  2. A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
  3. Domain name must be pointed to your Alibaba Cloud ECS’s IP address
  4. Access to VNC console in your Alibaba Cloud or SSH client installed in your PC
  5. Set up your server’s hostname and create user with root privileges.

Update Your Ubuntu System

Before proceeding with installation of any kind of package, use the following command to update your Ubuntu system. To execute this command, remember to login from non-root user with sudo privileges. After execution of this command, you will be prompted to Is this ok? Type ‘y’ and hit Enter.

Install build-essential

To install build-essential execute the command.

Install Git

You will need to install Git on your server as well as local machine. To install and configure Git, follow the steps below.

Step 1: To install Git execute the command.

Step 2 (Optional): Execute the commands below to configure Git by providing your name and valid email address so that commit messages may contain your correct information.

Install libpng-dev

To install libpng-dev execute the command.

Install PHP

Monica requires installation of PHP 7.1 or newer version of PHP. In this tutorial, you will install PHP 7.2. To install PHP 7.2, execute the following steps.

First, you will need to install python software properties and software properties common. To do so, execute the command below.

You will need to add repository for newer versions of PHP. To do so, execute the commands below.

Next, update the system to refresh the available repositories. To do so, execute the command for updating Ubuntu system.

Now install PHP 7.2. To install PHP 7.2, execute the following command.

Install Required PHP Extensions

Monica requires the following PHP extensions:

  1. php7.2-cli
  2. php7.2-fpm
  3. php7.2-mbstring
  4. php7.2-common
  5. php7.2-xml
  6. php7.2-mysql
  7. php7.2-curl
  8. php7.2-zip
  9. php7.2-intl

To install the above extensions of PHP, execute the following command.

To check PHP installation, you can execute the following command to check the installed PHP version.

Install MySQL

As Monica is developed in Laravel PHP framework, Laravel supports MySQL, MS SQL, SQLite, MariaDB, Redis and PostgreSQL databases. In this tutorial, you will install MySQL server for Monica database. Follow the steps below to install MySQL.

Install MySQL using the following command.

Run the following command to enhance security of MySQL server and set password for the root user.

Connect to the MySQL shell as root user using the command below and enter your password.

Image for post
Image for post

Install Nginx Server

Before starting installation of Nginx server, you will need to stop apache service. To do so, execute the command below.

Execute the command below to install Nginx server.

Start Nginx server by executing command below.

To check installation of Nginx server, you can execute the following command.

Create Nginx configuration file for Monica. Execute the following command, a file will be opened in nano text editor.

Copy and paste the following code and save the file.

Create symlink of newly created file’s configuration to enabled-sites directory. To do so, execute the command below.

Execute the following command to test the syntax of Nginx configuration file.

Execute the following command to reload the updated configurations.

Monica requires 10.x version of Node.JS. To install it, add the source and then install Node.JS. To do so, execute the following commands.

To verify successful installation of node and node package manager, run the following command.

Install Composer

Laravel requires composer. As Monica is Laravel based application, to install composer, follow the steps below.

Execute the following command to fetch the installer for composer setup.

Execute the following command to verify the installer for composer.

Execute the following commands to install and configure composer.

To verify installation of composer, execute the following command.

Install and Configure Monica

Navigate to root document directory.

Clone the files of Monica from Git repository by executing commands below.

Navigate to /var/www/monica

Change the ownership of newly created directory to your username.

Execute the following command to create .env (environment variables file). This will be your own version of environmental variables.

Execute the following command to open the created .env file in nano text editor and update the values of environmental variables like DB_USERNAME and DB_PASSWORD and save the file.

Image for post
Image for post

Install all required packages using composer by executing the command.

Compile CSS and JS assets by running the command below.

Execute the following command to generate an application key that will correct APP_KEY to correct value automatically.

Run the following command, it will run migrations, seed database and symlink folders.

After execution of the above command, you will see the following output screen.

Image for post
Image for post

Change the ownership of monica folder and assign Nginx user so that Nginx can access files of your application.

You can access Monica via ECS IP address or your domain name. In my case, I have setup domain. After accessing Monica, you will be redirected to sign up page to create account as shown below.

Image for post
Image for post

After registering your first account, you will see the following screen which is dashboard of Monica.

Image for post
Image for post

Congratulations! You can now use Monica: Personal Relationship Management System on your Alibaba Cloud Elastic Compute Service (ECS) instance.

Reference:https://www.alibabacloud.com/blog/how-to-install-and-set-up-monica_594207?spm=a2c41.12329772.0.0

Written by

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store