How to Install and Set Up Monica

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.

# sudo apt update && sudo apt upgrade

Install build-essential

To install build-essential execute the command.

# sudo apt-get install build-essential

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.

# sudo apt-get install git
# git config --global user.name "Aareez"
# git config --global user.email "xyz@example.com"

Install libpng-dev

To install libpng-dev execute the command.

# sudo apt-get install libpng-dev

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.

# sudo apt-get install software-properties-common python-software-properties
# sudo add-apt-repository ppa:ondrej/php
# sudo apt update
# sudo apt install -y php7.2

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
# sudo apt install -y php7.2-cli php7.2-fpm php7.2-common php7.2-mbstring php7.2-xml php7.2-mysql php7.2-curl php7.2-zip php7.2-intl
# 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.

# sudo apt install -y mysql-server
# sudo mysql_secure_installation
# sudo mysql -u root -pCREATE DATABASE monicadb;
CREATE USER 'monica'@'localhost' IDENTIFIED BY '654321Ab';
GRANT ALL PRIVILEGES ON monicadb.* TO monica@localhost;
FLUSH PRIVILEGES;
EXIT;

Install Nginx Server

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

# sudo systemctl stop apache2
# sudo apt-get install nginx
# sudo systemctl start nginx
# sudo nginx -v
# sudo nano /etc/nginx/sites-available/monica.conf
server {
listen 80;
listen [::]:80;
server_name softpedia.xyz;
root /var/www/monica/public;
index index.php; location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
}
# sudo ln -s /etc/nginx/sites-available/monica.conf /etc/nginx/sites-enabled/
# sudo nginx -t
# sudo systemctl reload nginx
# curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
# sudo apt-get install nodejs
# node -v && npm -v

Install Composer

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

# php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
# php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { 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
# composer --version

Install and Configure Monica

Navigate to root document directory.

# cd /var/www
# sudo git clone https://github.com/monicahq/monica.git
# cd monica
# sudo git checkout tags/v2.1.1
# sudo chown -R aareez:aareez /var/www/monica
# cp .env.example .env
# sudo nano .env
# composer install --no-interaction --no-suggest --no-dev --ignore-platform-reqs
# npm run production
# php artisan key:generate
# php artisan setup:production
# sudo chown -R www-data:www-data /var/www/monica

--

--

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
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com