How to Install Monica CRM on Ubuntu with Nginx
Monica CRM is a self-hosted personal relationship manager that lets you track interactions, gift ideas, and important dates for friends and family on your own server. Running this app on Ubuntu 24.04 paired with the Nginx web server keeps your personal data private on your own hardware instead of a third-party cloud service.
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 acts as the web server that delivers Monica CRM to your browser.
Grab the detailed setup steps from the guide on how to install Nginx on Ubuntu Linux before moving forward.
Install MariaDB
Monica CRM stores your data in a database, and MariaDB is the recommended database choice for the CRM. Install MariaDB on Ubuntu using the sudo apt install mariadb-server 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 processes the dynamic code that Monica CRM relies on. Follow the guide on how to install PHP or PHP-FPM on Ubuntu Linux to get the right packages installed.
Install Composer
To install Composer (a tool that manages PHP software packages) during your Monica CRM installation Ubuntu process, download and set up the installer script in your terminal. Composer handles all the background code libraries that Monica needs to run correctly on your server.
Composer manages the underlying software packages that Monica CRM requires to function properly.
Your Monica CRM installation on Ubuntu needs a dedicated database and user. A new database and a specific user will be created for Monica CRM's data storage. This pairing ensures Monica CRM has a secure, separate location for all its important information.
sudo mysql -u root -p
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
To finish your Monica CRM installation Ubuntu setup, download the application files to your web directory and run the dependency and database commands. These terminal commands fetch the required software packages, build the front-end assets, and generate your application encryption key.
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 (which routes requests to PHP) points to the correct 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, consider 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!