How To Install Meilisearch on Ubuntu 24.04
What is Meilisearch?
Meilisearch is an open-source, RESTful search engine written in Rust. It's designed to deliver instant, typo-tolerant, and full-text search capabilities out of the box. Think of it as the open-source alternative to Algolia, but with full control — no rate limits, no API cost tiers.
Some standout features:
- Full-text search with typo-tolerance
- High performance (thanks to Rust)
- RESTful API
- Easy setup with minimal dependencies
- Supports filters, synonyms, ranking rules
- Open-source and self-hosted
Prerequisites
Before we begin, let’s ensure we have the following in place:
- A Ubuntu 24.04 dedicated server or KVM VPS.
- A basic programming knowledge.
- A domain name pointing to server IP.
How to Install Meilisearch on Ubuntu 24.04 with Nginx SSL – Step-by-Step Self-Hosted Search Engine Guide [2025]
Step 1: Update the Ubuntu System
We begin by updating our system to ensure we’re working with the latest security patches and libraries.
sudo apt update && sudo apt upgrade -y
This ensures that our system is clean and ready for any new installations.
Step 2: Install Required Dependencies
Meilisearch doesn’t require a heavy stack, but we’ll need curl and unzip to handle the binary download:
sudo apt install curl unzip -y
These tools help us download and extract the latest Meilisearch release from the official GitHub repository.
Step 3: Download the Latest Meilisearch Binary
Head over to the official GitHub release page to find the latest stable version:
We’ll download the latest Linux x86_64 build using the command below:
curl -L https://install.meilisearch.com | sh
This script downloads the binary, makes it executable, and places it in our working directory.
To move it to a global location:
sudo mv meilisearch /usr/local/bin/
Step 4: Start Meilisearch for the First Time
Now that it’s installed, we can launch Meilisearch with a simple command:
meilisearch
By default, it runs on port 7700 with no authentication. Let’s verify that it’s working by opening:
http://localhost:7700
We should see a JSON welcome message from Meilisearch's API.
Step 5: Configure Meilisearch with Environment Variables
For production environments, we’ll want to enable an API key, change the host/port, and persist data.
Let’s create a directory for storing Meilisearch data:
sudo mkdir -p /var/lib/meilisearch
sudo chown $USER /var/lib/meilisearch
Now, we can start Meilisearch with persistent storage and security:
MEILI_MASTER_KEY="mySuperSecretKey" \
MEILI_ENV="production" \
MEILI_DB_PATH="/var/lib/meilisearch" \
meilisearch
Replace "mySuperSecretKey
" with a secure API key.
To make this permanent, we’ll set up a systemd service next.
Step 6: Create a Systemd Service (Auto-Start on Boot)
Let’s make sure Meilisearch starts on system boot and runs in the background:
sudo nano /etc/systemd/system/meilisearch.service
Paste the following config:
[Unit]
Description=Meilisearch
After=network.target
[Service]
User=ubuntu
ExecStart=/usr/local/bin/meilisearch \
--env production \
--db-path /var/lib/meilisearch \
--master-key mySuperSecretKey
Restart=always
[Install]
WantedBy=multi-user.target
Replace ubuntu
with the actual username of the machine. Save and exit.
Enable and start the service:
sudo systemctl daemon-reexec
sudo systemctl enable meilisearch
sudo systemctl start meilisearch
Now Meilisearch is running as a background service, even after reboots.
Step 7: Interact with the Meilisearch API
We can now use tools like curl, Postman, or our frontend/backend to interact with Meilisearch.
Example: Add an Index and Documents
curl \
-X POST 'http://localhost:7700/indexes/movies/documents' \
-H 'Authorization: Bearer mySuperSecretKey' \
-H 'Content-Type: application/json' \
--data-binary '[
{ "id": 1, "title": "Inception", "genre": "Sci-Fi" },
{ "id": 2, "title": "Avengers", "genre": "Action" }
]'
Example: Perform a Search