Install MeiliSearch on Ubuntu 22.04

Install MeiliSearch on Ubuntu 22.04

MeiliSearch is an open-source search engine written in the Rust programming language. This search engine provides customizable search and indexing, understands typos, supports full-text search, synonyms, and offers other features.

This tutorial shows how to install MeiliSearch on Ubuntu 22.04.

Install MeiliSearch

Download the latest MeiliSearch executable file from the releases page in GitHub repository:

sudo wget -qO /usr/local/bin/meilisearch

Set execute permission:

sudo chmod a+x /usr/local/bin/meilisearch

We can check MeiliSearch version:

meilisearch --version

Run MeiliSearch as a service

Now we need to configure systemd in order to run MeiliSearch as a service. So create a systemd unit file:

sudo nano /etc/systemd/system/meilisearch.service

Copy the following content to the file:

Description=MeiliSearch search engine

ExecStart=/usr/local/bin/meilisearch --http-addr --env production --master-key pwd123


Change value for --master-key option. It specifies a master key which is used to access or create documents, indexes, or change configuration via API. Save and close file.

Note that binds MeiliSearch to all network interfaces. It accepts connections from any IPv4 address.

Now start MeiliSearch service:

sudo service meilisearch start

You can use the following command to make sure that MeiliSearch service is running:

sudo service meilisearch status

Also, you can stop or restart the service:

sudo service meilisearch stop
sudo service meilisearch restart

To enable MeiliSearch to start on boot, execute the following command:

sudo systemctl enable meilisearch

Testing MeiliSearch

Download movies dataset:

curl -Lo movies.json

Send POST request to index data:

curl -X POST --data-binary @movies.json \
    -H 'Authorization: Bearer pwd123' \
    -H 'Content-Type: application/json' \

Don't forget to change key and IP address of your machine.

Now send GET request to search movies:

curl -H 'Authorization: Bearer pwd123'

MeiliSearch will return a response in JSON format.

  "hits": [
      "id": "315635",
      "title": "Spider-Man: Homecoming",
      "poster": "https://...",
      "overview": "...",
      "release_date": 1499216400
  "nbHits": 11,
  "exhaustiveNbHits": false,
  "query": "spiderman",
  "limit": 20,
  "offset": 0,
  "processingTimeMs": 3

Uninstall MeiliSearch

If you want to completely remove the MeiliSearch, stop the service and remove a systemd unit file.

sudo service meilisearch stop
sudo systemctl disable meilisearch
sudo rm -rf /etc/systemd/system/meilisearch.service
sudo systemctl daemon-reload
sudo systemctl reset-failed

Delete the executable file::

sudo rm -rf /usr/local/bin/meilisearch

You can also remove MeiliSearch data:

sudo rm -rf /

The 1 Comment Found

Leave a Comment

Cancel reply

Your email address will not be published.