X

How to install Monica on Ubuntu 16.04

Spread the love

We’ll show you, How to install Monica on Ubuntu 16.04. Monica is a Personal Relationship Management (PRM) system written in Laravel framework. It is designed and built to help you have more meaningful relationships with your friends and family, and keep track of all important details about your friends and family. In this tutorial we will install Monica on an Ubuntu 16.04 VPS

Monica has several requirements:

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

First of all, login to your server via SSH as user root

ssh root@IP_ADDRESS -p PORT_NUMBER

Update the system and install necessary 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 among with some dependencies

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

Install MySQL server on your VPS

apt-get install mysql-server

once the installation is completed, run the mysql_secure_installation script to secure your MySQL server

mysql_secure_installation

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 new MySQL user and database for Monica

mysql -u root -p

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

Don’t forget to replace ‘YOURPASSWORD’ with an actual strong password.

Clone the Monica git repository

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

Change the permissions of the Monica directory

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

Install nodejs (this is needed for npm)

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

Install composer

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');"

Once installed, run composer in the directory the repository has been cloned, to install Monica’s dependencies

cd /var/www/html/monica
composer install

Create .env file using the example provided and update it with your information.

cp .env.example .env

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=monica
DB_USERNAME=monicauser
DB_PASSWORD=YOURPASSWORD
DB_TEST_DATABASE=monica_test
DB_TEST_USERNAME=monicauser
DB_TEST_PASSWORD=YOURPASSWORD

Run the following command to generate an application key. It will set APP_KEY with the right value automatically.

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

Run all migrations executing the following command

php artisan migrate

Enable avatar uploads for the contacts created in Monica

php artisan storage:link
The [public/storage] directory has been linked.

Populate the activity types and countries table

php artisan db:seed --class ActivityTypesTableSeeder
php artisan db:seed --class CountriesSeederTable

In order for the reminders to work properly, we have to set a cronjob that runs every minute with the following command

php artisan schedule:run

Once Monica is successfully installed on your server, you can access it at http://yourIPaddress/monica


Of course, you don’t have to do any of this if you use one of our Software Installation Services, in which case you can simply ask our expert Linux admins to install Monica for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Categories: Tutorials
admin:
Related Post