How to Install Monica on Manjaro

Monica is an open-source personal relationship management tool that lets you manage all the relationships in your life. In this tutorial, we will guide you through the process of installing Monica on Manjaro Linux.

Prerequisites

Before we start, make sure your system meets the following prerequisites:

Step 1: Install Required Dependencies

To install Monica on Manjaro, we first need to make sure some packages are installed. Open a terminal window and enter the following command to install the necessary dependencies:

sudo pacman -S git nginx mariadb php php-fpm imagemagick

Step 2: Download Monica

Now, we need to download Monica from the official website. For this, run the following command:

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

Step 3: Configure Nginx

Next, we need to configure Nginx to host our Monica installation. Open the default Nginx configuration file /etc/nginx/nginx.conf with a text editor of your choice.

sudo nano /etc/nginx/nginx.conf

Update these two configuration blocks:

server {
    listen      80;
    server_name monica.local;

    root        /var/www/monica/public;
    index       index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~* ^/uploads/ {
        try_files $uri /index.php?$query_string;
    }

    location ~ \.php$ {
        include php-fpm;
        fastcgi_param SCRIPT_FILENAME /var/www/monica/public/$fastcgi_script_name;
    }

    location ~ /\. {
        deny all;
    }
}

Update the server_name to your own domain name.

Step 4: Start the Database Service

We also need to start the MariaDB service. Run the following command to start the service:

sudo systemctl start mariadb

Step 5: Configure the Database

Next, we need to create a new database for Monica. Run the following command in the terminal:

sudo mysql -u root -p -e "CREATE DATABASE monica;"

After running the command, you will be prompted for the root user password. Enter the password when prompted.

Step 6: Configure .env File

We need to configure the .env file in our Monica installation with the database credentials. Run the following command to duplicate the example .env file:

cd /var/www/monica
cp .env.example .env

Next, we need to edit the .env file using a text editor. You can use your favorite text editor to edit the file /var/www/monica/.env. Update the following configuration:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=monica
DB_USERNAME=root
DB_PASSWORD=

Step 7: Install Dependencies with Composer

To install the dependencies for Monica, we will use the Composer package manager. Go to the Monica installation directory and run the following command:

cd /var/www/monica
composer install --no-dev --prefer-dist

Step 8: Set File Permissions

Make sure that the file permissions for the storage and bootstrap/cache directories are set correctly. Run the command:

chmod -R 775 /var/www/monica/bootstrap/cache /var/www/monica/storage

Step 9: Create a Admin User

Finally, we need to create an admin user to access Monica. Run the following command:

php artisan setup:admin

Follow the on-screen instructions to complete the admin user setup.

Step 10: Restart Nginx & PHP-FPM Services

To apply the changes, we need to restart the Nginx and PHP-FPM services. Run the following commands to restart the services:

sudo systemctl restart nginx php-fpm

Step 11: Open Monica

Open your web browser and enter the domain name that you have set up for Monica in Step 3. You should see the Monica login page, where you can log in with your admin user credentials.

Congratulations! You have successfully installed Monica on Manjaro Linux.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!