Skip to content
Follow
CMS Ubuntu Linux

How to Install Monica CRM on Ubuntu with Nginx

Richard
Written by
Richard
Oct 17, 2022 Updated Jun 19, 2026 3 min read
How to Enable or Disable Microsoft Defender Cloud Protection
How to Enable or Disable Microsoft Defender Cloud Protection

You install Monica CRM on Ubuntu using Nginx as your web server.

Monica CRM is an open-source relationship management tool that helps you track contacts, birthdays, events, and personal interactions.

This tutorial guides you through a manual installation process for Monica CRM on Ubuntu 24.04 and later versions, configuring Nginx to serve the application.

By following these steps, you will set up your own self-hosted web portal for securely managing all your personal contacts.

⚡ Quick Answer

Install Nginx, MariaDB, and PHP-FPM using apt commands. Then, download Composer and Node.js. Create a database for Monica, download Monica from GitHub to /var/www/monica, and configure the .env file. Finally, install dependencies with composer and yarn, and run artisan commands.

Install Nginx

Nginx is a fast and reliable web server that Monica CRM needs to run on Ubuntu.

🐧Bash / Shell
sudo apt update
sudo apt install nginx

If you need more help with Nginx, check out this guide: How to install Nginx on Ubuntu Linux.

Install MariaDB

Monica stores your data in a database. MariaDB is the recommended choice. Install it with this command:

🐧Bash / Shell
sudo apt update
sudo apt install mariadb-server

Find additional database help here How to install MariaDB on Ubuntu Linux.

Install PHP-FPM

PHP-FPM is a program that helps PHP work efficiently with your web server, which Monica CRM needs to run.

🐧Bash / Shell
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.3-fpm php8.3-cli php8.3-common php8.3-mbstring php8.3-xml php8.3-mysql php8.3-curl php8.3-zip php8.3-intl php8.3-bcmath php8.3-gd php8.3-gmp php8.3-redis

For more help with PHP, see this link How to install PHP or PHP-FPM on Ubuntu Linux.

Install Composer

Composer is a tool that manages the code libraries Monica CRM needs to run, and installing it is a key step for your Monica CRM installation on Ubuntu.

🐧Bash / Shell
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php --install-dir=/usr/bin --filename=composer
php -r "unlink('composer-setup.php');"

Install Node.js and Yarn

These tools handle the visual parts of the Monica interface. We use the current LTS version (v22+).

🐧Bash / Shell
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
sudo corepack enable
sudo corepack prepare yarn@stable --activate

Create Monica Database

Monica CRM needs its own database to store all its information, so you’ll create a new database and user for it during the Monica CRM installation on Ubuntu.

🐧Bash / Shell
sudo mysql -u root -p

Run these commands to set up the database and user:

💻Code
CREATE DATABASE monicadb;
CREATE USER 'monicadbuser'@'localhost';
ALTER USER 'monicadbuser'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL ON monicadb.* TO 'monicadbuser'@'localhost';
FLUSH PRIVILEGES;
exit

Install Monica

Now it’s time to install Monica CRM itself on your Ubuntu server, which involves downloading the latest version and setting up its configuration.

🐧Bash / Shell
sudo -u www-data composer install --no-interaction --no-dev
sudo -u www-data yarn install
sudo -u www-data yarn run production

🐧Bash / Shell
sudo -u www-data php artisan key:generate
sudo -u www-data php artisan setup:production -v

Configure Nginx

Create a server block file in `/etc/nginx/sites-available/monicacrm`. Ensure the `fastcgi_pass` directive points to the correct PHP socket version:

🐘PHP
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;

Enable the site, test the configuration, and restart Nginx to apply the changes.

Access Monica Portal

Navigate to your domain in your web browser. You can now register your account and begin using your CRM. For security, we recommend setting up SSL using Let’s Encrypt How to install and use Let’s Encrypt SSL with Nginx on Ubuntu Linux.

[signed-by=/usr/share/keyrings/yarnkey.gpg]

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Install FossBilling with Nginx on Ubuntu Linux
CMS How to Install FossBilling with Nginx on Ubuntu Linux
How to Install FreeScout with Nginx on Ubuntu Linux
CMS How to Install FreeScout with Nginx on Ubuntu Linux
How to Install Etherpad on Ubuntu Linux
Ubuntu Linux How to Install Etherpad on Ubuntu Linux
How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *