In this tutorial, we'll learn how to install Typesense on Ubuntu 24.04 with some practical examples.
Introduction
Typesense is a fast, open-source search engine that gives smooth, typo-tolerant search results. Works great for blogs, web apps, docs, e-commerce search and anything that needs blazing-fast search.
Below is a clear step-by-step setup on Ubuntu 24.04, including installation, configuration, startup, firewall, API usage, and sample data indexing.
Prerequisites
Before we begin, ensure we have the following:
- An Ubuntu 24.04 on dedicated server or KVM VPS.
- Basic Linux Command Line Knowledge.
- A domain name pointing A record to server IP.
How to Install Typesense on Ubuntu 24.04
Step 1: Update Server
We make sure Ubuntu is fresh before installing anything.
sudo apt update && sudo apt upgrade -y
Step 2: Install Required Tools
We install basic tools we’ll need.
sudo apt install -y curl wget unzip
Step 3: Download & Install Typesense (.deb Package)
We download the latest version number from Typesense downloads page, then install it.
cd /tmp
curl -O https://dl.typesense.org/releases/29.0/typesense-server-29.0-amd64.deb
sudo apt install ./typesense-server-29.0-amd64.deb
Start Typesense
sudo systemctl start typesense-server.service
Step 4: Create Main Config File
This tells Typesense how to run and where to store data.
sudo mkdir -p /etc/typesense
sudo nano /etc/typesense/typesense-server.ini
Paste inside and replace the API key later:
[server]
api-address = 0.0.0.0
api-port = 8108
data-dir = /var/lib/typesense
api-key = EmGTHb3m3zxg45RuL61oooxthZT58AGWok2Xqi4nuJ5WBYfa
log-dir = /var/log/typesense
Save the file.
If we ever change config → restart:
sudo systemctl restart typesense-server
If something breaks:
sudo journalctl -u typesense-server -xe
Step 5: Verify It’s Running Correctly
curl http://localhost:8108/health
Expected output:
{"ok":true}
If using public server:
curl http://SERVER_IP:8108/health
Step 6: Firewall Settings (Recommended)
We keep the server secure.
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp # optional if API will be public
sudo ufw allow 443/tcp # optional if API will be public
sudo ufw enable
sudo ufw status verbose
Step 7: Create Collection & Add Documents
You will find API key in /etc/typesense/typesense-server.ini file.
Create collection
curl "http://localhost:8108/collections" \
-X POST \
-H "X-TYPESENSE-API-KEY: EmGTHb3m3zxg45RuL61oooxthZT58AGWok2Xqi4nuJ5WBYfa" \
-H "Content-Type: application/json" \
-d '{
"name": "books",
"fields": [
{"name": "id", "type": "string"},
{"name": "title", "type": "string"},
{"name": "author", "type": "string"},
{"name": "year", "type": "int32"},
{"name": "description", "type": "string"}
],
"default_sorting_field": "year"
}'
Import some sample data
curl "http://localhost:8108/collections/books/documents/import?action=create" \
-X POST \
-H "X-TYPESENSE-API-KEY: EmGTHb3m3zxg45RuL61oooxthZT58AGWok2Xqi4nuJ5WBYfa" \
-H "Content-Type: text/plain" \
--data-binary '
{"id": "1", "title": "Clean Code", "author": "Robert C. Martin", "year": 2008, "description": "Agile craftsmanship."}
{"id": "2", "title": "The Pragmatic Programmer", "author": "Andrew Hunt", "year": 1999, "description": "Modern development tips."}
'
Search data instantly
curl "http://localhost:8108/collections/books/documents/search" \
-X GET \
-H "X-TYPESENSE-API-KEY: EmGTHb3m3zxg45RuL61oooxthZT58AGWok2Xqi4nuJ5WBYfa" \
-G \
--data-urlencode "q=clean" \
--data-urlencode "query_by=title,description"
Fast search, live results.
Step 8: Configure Nginx
First, let's install Nginx:
sudo apt update
sudo apt install -y nginx
Start Nginx:
sudo systemctl enable nginx
sudo systemctl start nginx
Check status:
sudo systemctl status nginx
If the browser shows "Welcome to Nginx" when we visit our server IP, it's working.
Create Nginx reverse proxy config
Replace search.example.com with our real domain.
sudo nano /etc/nginx/sites-available/typesense.conf
Add:
server {
listen 80;
server_name search.example.com;
location / {
proxy_pass http://127.0.0.1:8108;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Save.
Enable config and reload Nginx
sudo ln -s /etc/nginx/sites-available/typesense.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
If no errors → we move ahead.
Step 9: Install Certbot (SSL generator)
sudo apt install python3-certbot-nginx -y
Generate SSL Certificate (HTTPS)
sudo certbot --nginx -d search.example.com
Follow on-screen steps.
When successful, Certbot updates Nginx automatically and we get HTTPS enabled.
Visit:
https://search.example.com/health
We should see:
{"ok":true}
If we see that, SSL is live and reverse proxy is working.
Renewing SSL Automatically
sudo certbot renew --dry-run
If this succeeds, certificates will auto-renew every ~60 days.
Conclusion
We took Typesense from a simple installation on Ubuntu 24.04 to a fully secured, production-ready setup running behind Nginx with HTTPS.This setup is flexible enough for blogs, SaaS products, documentation platforms, e-commerce search, dashboards or any application that demands quick and accurate querying.
The installation steps are simple, the configuration is lightweight, and scaling later is painless if traffic grows. We now have a reliable foundation where we can index collections, run queries, integrate with applications, and build a real search experience that feels modern.
