How to Install Monica CRM on Ubuntu with Nginx
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.
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.
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:
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.
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.
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+).
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.
sudo mysql -u root -p
Run these commands to set up the database and user:
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.
sudo -u www-data composer install --no-interaction --no-dev sudo -u www-data yarn install sudo -u www-data yarn run production
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:
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?
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.
No comments yet — be the first to share your thoughts!