Setting Up a Fast, Self-Hosted Search Engine – Meilisearch

2025-11-03 11:11:12 - No Comments

Dependencies and building meilisearch

First we need to setup some dependencies and install rust.

sudo apt install git curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Downloading and compiling the large executable for meiliesearch. This can take up to 30 minutes.

git clone https://github.com/meilisearch/meilisearch.git
cd meilisearch
cargo build --release
sudo cp target/release/meilisearch /usr/local/bin/

Setup work directories

To run this as a service we need a user and a couple of work directories.

sudo -H useradd --shell /bin/bash --system --home-dir "/var/share/meilisearch" --comment 'A lightning-fast AI search engine' meilisearch

sudo mkdir -p /var/share/meilisearch/dumps
sudo mkdir -p /var/share/meilisearch/snapshots
sudo chown -R meilisearch:meilisearch /var/share/meilisearch

Configuration Option A

Next we open a new configuration file for the service.

sudo vi /etc/meilisearch.toml

This is an example of configuration and it uses mainly default values.

db_path = "/var/share/meilisearch/data.ms"
env = "production"
http_addr = "0.0.0.0:7700"
master_key = "e38cc5a40c10cec82e2e6305bd41f578"
no_analytics = true
http_payload_size_limit = "100 MB"
log_level = "INFO"
# max_indexing_memory = "2 GiB"
# max_indexing_threads = 4
dump_dir = "/var/share/meilisearch/dumps/"
ignore_missing_dump = false
ignore_dump_if_db_exists = false
schedule_snapshot = false
snapshot_dir = "/var/share/meilisearch/snapshots/"
ignore_missing_snapshot = false
ignore_snapshot_if_db_exists = false
ssl_require_auth = false
ssl_resumption = false
ssl_tickets = false
experimental_enable_metrics = false
experimental_reduce_indexing_memory_usage = false

Configuration Option B

Another option for you is to download the default configuration and do changes after your needs.

curl https://raw.githubusercontent.com/meilisearch/meilisearch/latest/config.toml > /etc/meilisearch.toml

Setup service

Now that we have a configuration we can configuration service. Open a new service file

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

The file below is the minimal service configuration we need for our meilisearch.

[Unit]
Description=MeiliSearch service
Wants=network-online.target

[Install]
WantedBy=multi-user.target

[Service]
RuntimeDirectory=meilisearch
Type=simple
User=meilisearch
Group=meilisearch
TimeoutStartSec=0
Restart=always
RestartSec=10s
PIDFile=/run/meilisearch/meilisearch.pid
ExecStart=/usr/local/bin/meilisearch --config-file-path /etc/meilisearch.toml

Last but not least, start and enable the service so it will run on reboot.

sudo systemctl daemon-reload
sudo systemctl start meilisearch
sudo systemctl enable meilisearch
sudo systemctl status meilisearch

Be the first to leave a comment!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.