Friday, December 27, 2024
Google search engine
HomeGuest BlogsHow To Install Monica CRM on Ubuntu 22.04|20.04|18.04

How To Install Monica CRM on Ubuntu 22.04|20.04|18.04

Question: How can I install Monica CRM on Ubuntu 22.04|20.04|18.04 Linux system?. Monica is an open source web-based Personal Relationship Manager application to organize the interactions with your loved ones.

Monica CRM helps you keep track of everything that’s important about their friends and family. This application is for people who have a hard time remembering details about other people’s lives – especially the ones they care about.

In this guide, we’ll see how you can install and use Monica CRM on Ubuntu Linux system.

Monica PRM Principles

  • It should help have better relationships.
  • It should be simple to use, simple to contribute to, simple to understand, extremely simple to maintain.
  • It is not a social network and shall never be.
  • It is not and will never be ad-supported.
  • Users are not and will never be tracked.
  • It should be transparent.
  • It should be open-source.
  • It should do one thing (documenting social interactions) extremely well, and nothing more.
  • It should be well documented.

Features of Monica Personal Relationship Manager

The features of Monica PRM as stated on Github page are:

  • Add and manage contacts
  • Define relationships between contacts
  • Reminders
  • Auto reminders for birthdays
  • Stay in touch with a contact by sending reminders at a given interval
  • Management of debts
  • Ability to add notes to a contact
  • Ability to indicate how you’ve met someone
  • Management of activities done with a contact
  • Management of tasks
  • Management of gifts
  • Management of addresses and all the different ways to contact someone
  • Management of contact field types
  • Management of contact pets
  • Basic journal
  • Ability to indicate how the day went
  • Export and import of data
  • Export a contact as vCard
  • Ability to set custom genders
  • Ability to define custom activity types
  • Ability to favorite contacts
  • Track conversations made on social media or SMS
  • Multi-users
  • Labels to organize contacts
  • Ability to define what section should appear on the contact sheet
  • Multi-currencies
  • Multi-languages
  • An API that covers most of the data
  • We also have official mobile apps, also open source

Monica setup Requirements

  • PHP 7.1+ or newer
  • Node.js 18+
  • HTTP server with PHP support (eg: Apache, Nginx, Caddy)
  • Composer
  • Git
  • MySQL Database

Install Monica CRM on Ubuntu Ubuntu 22.04|20.04|18.04

This section will cover installation of Monica PRM dependencies and deployment of the actual application on your Ubuntu server.

Before installation first update and upgrade your system:

sudo apt update && sudo sudo apt -y full-upgrade
[ -f /var/run/reboot-required ] && sudo reboot -

Step 1: Install PHP, Composer, and Apache

Start by installing PHP 7.2 on Ubuntu and compose dependency manager for PHP:

sudo apt install -y 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 php-gmp php-redis

When done, install composer:

sudo apt remove composer
cd /tmp
curl -s https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin/ --filename=composer
rm -f composer-setup.php
cd ~/

Install Apache web server by running:

sudo apt install apache2 libapache2-mod-php

Step 2: Install MariaDB Server

Install MariaDB database server and client.

sudo apt install mariadb-server mariadb-client

Once MariaDB service is running, log in with the root account to configure the database.

$ sudo mysql -uroot
CREATE DATABASE monica CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'monica'@'localhost' IDENTIFIED BY 'StrongPassword';
GRANT ALL ON monica.* TO 'monica'@'localhost';
FLUSH PRIVILEGES;
exit

Step 3: Install Monica CRM on Ubuntu Linux

Install Node.js on your system.

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
sudo npm install --global yarn

Now download Monica fro Github and configure it.

git clone https://github.com/monicahq/monica.git
sudo mv monica /var/www
cd /var/www/monica
sudo git fetch

Create your own version of environment variables.

sudo cp .env.example .env

Update .env to your specific needs. Replace crm.example.com with your actual domain name for Monica CRM.

$ sudo vim .env
APP_URL=http://crm.example.com
DB_DATABASE=monica
DB_USERNAME=monica
DB_PASSWORD=StrongPassword

Install all PHP packages by running:

sudo composer install --no-interaction --no-dev

Sample output:

....
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover

   INFO  Discovering packages.

  asbiin/laravel-adorable ............................................... DONE
  asbiin/laravel-webauthn ............................................... DONE
  creativeorange/gravatar ............................................... DONE
  intervention/image .................................................... DONE
  laravel/cashier ....................................................... DONE
  laravel/passport ...................................................... DONE
  laravel/socialite ..................................................... DONE
  laravel/ui ............................................................ DONE
  laravolt/avatar ....................................................... DONE
  mariuzzo/laravel-js-localization ...................................... DONE
  monicahq/laravel-cloudflare ........................................... DONE
  monicahq/laravel-sabre ................................................ DONE
  nesbot/carbon ......................................................... DONE
  nunomaduro/termwind ................................................... DONE
  pragmarx/google2fa-laravel ............................................ DONE
  rinvex/countries ...................................................... DONE
  sentry/sentry-laravel ................................................. DONE
  stevebauman/location .................................................. DONE
  vinkla/hashids ........................................................ DONE
  vluzrmos/language-detector ............................................ DONE
  werk365/etagconditionals .............................................. DONE

92 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> Illuminate\Foundation\ComposerScripts::postInstall

Install frontend packages:

$ sudo yarn install
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "@babel/core@^7.15.8".
warning " > [email protected]" has unmet peer dependency "@babel/plugin-proposal-object-rest-spread@^7.15.6".
warning " > [email protected]" has unmet peer dependency "@babel/plugin-syntax-dynamic-import@^7.8.3".
warning " > [email protected]" has unmet peer dependency "@babel/plugin-transform-runtime@^7.15.8".
warning " > [email protected]" has unmet peer dependency "@babel/preset-env@^7.15.8".
warning " > [email protected]" has unmet peer dependency "webpack@^5.60.0".
warning " > [email protected]" has unmet peer dependency "webpack-cli@^4.9.1".
warning " > [email protected]" has unmet peer dependency "css-loader@*".
warning " > [email protected]" has unmet peer dependency "webpack@^3.0.0 || ^4.1.0 || ^5.0.0-0".
warning " > [email protected]" has unmet peer dependency "rxjs@^6.0.0".
warning " > [email protected]" has unmet peer dependency "rxjs@^6.5.2".
warning " > [email protected]" has incorrect peer dependency "eslint-plugin-promise@^4.2.1 || ^5.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^1 || ^2 || ^3 || ^4 || ^5".
warning " > [email protected]" has unmet peer dependency "webpack@^5.0.0".
[5/5] Building fresh packages...
$ yarn run snyk-protect
yarn run v1.22.19
$ snyk-protect
Applied Snyk patches.
Done in 1.21s.
Done in 53.52s.

Next build the assets (js, css).

sudo yarn run production

Generate an application key and set APP_KEY with the right value automatically.

$ sudo php artisan key:generate
   INFO  Application key set successfully.

Run the migrations, seed the database and symlink folders. You can use email and password parameter to setup a first account directly

# Example
$ sudo php artisan setup:production --email=[email protected] --password=StrongPassword -v
You are about to setup and configure Monica. Do you wish to continue? (yes/no) [no]:
 > yes

✓ Maintenance mode: on
'/usr/bin/php8.1' 'artisan' down --retry="10"

✓ Clear config cache
'/usr/bin/php8.1' 'artisan' config:clear

✓ Clear route cache
'/usr/bin/php8.1' 'artisan' route:clear

✓ Clear view cache
'/usr/bin/php8.1' 'artisan' view:clear

✓ Performing migrations
'/usr/bin/php8.1' 'artisan' migrate --force

✓ Check for encryption keys
'/usr/bin/php8.1' 'artisan' monica:passport --force

✓ Ping for new version
'/usr/bin/php8.1' 'artisan' monica:ping --force

✓ Maintenance mode: off
'/usr/bin/php8.1' 'artisan' up

Monica v3.7.0 is set up, enjoy.
✓ Filling database
   INFO  Seeding database.

  FakeUserTableSeeder ...................................................................................................................... RUNNING
  FakeUserTableSeeder ............................................................................................................... 976.30 ms DONE


-----------------------------
|
| Welcome to Monica v3.7.0
|
-----------------------------
| You can now sign in to your account:
| username: [email protected]
| password: <hidden>
| URL:      http://crm.example.com
-----------------------------
Setup is done. Have fun.

Step 4: Configure a cron job

Monica requires some background processes to continuously run, setup a cron that runs every minute to trigger the command php artisan schedule:run.

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

Step 5: Configure Apache web server

Enable the rewrite module of the Apache web server:

sudo a2enmod rewrite
sudo systemctl restart apache2

Configure a new Monica Virtual Host site in apache by doing:

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

Populate the file with data:

<VirtualHost *:80>
    ServerName crm.example.com

    ServerAdmin [email protected]
    DocumentRoot /var/www/monica/public

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

Set proper permissions for Web directory

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

Check apache configuration syntax then restart Apache web service

$ sudo apachectl -t
Syntax OK

Disable default apache web page.

sudo a2dissite 000-default.conf
sudo rm /var/www/html/index.html

Enable Proxy and FPM:

sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php*-fpm
sudo systemctl restart php*-fpm.service apache2

The final step is to access Monica web interface on IP http://192.168.200.8/ or domain http://crm.example.com. Login with created username and password.

login monica crm

Else create admin user on first access if you din’t provide earlier.

monica add first user min

After clicking the Register button, you’ll get a welcome page

monica prm welcome page min

You should be ready to add your Friends and family members contacts.

monica prm add new user min

Thanks for using our guide to install Monica CRM on Ubuntu Linux. I hope this tool helps you keep in touch with old friends and have a balanced job/family time.

Similar guides:

RELATED ARTICLES

Most Popular

Recent Comments