How to Install Typesense on Elementary OS Latest
Typesense is an open source, fast and typo-tolerant search engine that can provide instant results for large datasets. If you are looking for a modern and scalable search engine for your application, Typesense is a great option.
In this tutorial, we will guide you through the process of installing Typesense on Elementary OS Latest step by step.
Prerequisites
Before proceeding with the installation, make sure that you have the following prerequisites:
- A user account with
sudoprivileges - Elementary OS Latest installed on your machine
- A terminal emulator app such as GNOME Terminal or Terminator
Step 1 - Install Dependencies
To begin with, we need to install some necessary dependencies that Typesense requires to function correctly. Open a terminal window and run the following command to update the system package list:
sudo apt update
Then, install these dependencies with the command:
sudo apt install git curl wget tar -y
Step 2 - Install Typesense
In this step, we will download and install Typesense on Elementary OS Latest. Follow these steps:
Step 2.1 - Download Typesense Package
First, we need to download the typesense-server binary file from the official website. Visit the Typesense download page and copy the URL of the latest version of the typesense-server binary file for Linux.
TYPESENSE_VERSION=x.x.x
wget https://dl.typesense.org/releases/$TYPESENSE_VERSION/typesense-server-$TYPESENSE_VERSION-linux-amd64.tar.gz
Replace x.x.x with the latest version of typesense-server.
Step 2.2 - Extract Typesense Package
After downloading the package, we need to extract it using the following command:
tar -xvf typesense-server-$TYPESENSE_VERSION-linux-amd64.tar.gz
Step 2.3 - Install Typesense
Now, we need to move the extracted folder to the desired location such as /opt or ~/bin. In this tutorial, we will install it to /opt.
Run the following commands:
sudo mkdir -p /opt/typesense
sudo cp typesense-server-$TYPESENSE_VERSION-linux-amd64/typesense-server /opt/typesense
sudo chmod +x /opt/typesense/typesense-server
Step 2.4 - Verify Typesense Installation
To verify that Typesense is installed correctly, run the following command:
/opt/typesense/typesense-server --version
If everything is working correctly, you should see the version number of Typesense on the terminal screen.
Step 3 - Start Typesense
Now that we have Typesense installed on our system, let's start it as a service so that it automatically starts at boot time.
Step 3.1 - Create a Typesense Service File
Run the following command to create a Typesense service file:
sudo nano /etc/systemd/system/typesense.service
Paste the following contents into the file:
[Unit]
Description=Typesense Server
After=network.target
[Service]
User=$USER
Group=$USER
Type=simple
ExecStart=/opt/typesense/typesense-server --api-key=YOUR_API_KEY --data-dir=/var/lib/typesense --pid-file=/run/typesense/typesense.pid
Restart=on-failure
SyslogIdentifier=typesense
[Install]
WantedBy=multi-user.target
Replace $USER with your current user's name and YOUR_API_KEY with your own API access key, which you can generate here.
Save the file and exit the editor.
Step 3.2 - Start the Typesense Service
Reload the systemd configuration files with the following command to enable the Typesense service:
sudo systemctl daemon-reload
Then start and enable Typesense with:
sudo systemctl start typesense
sudo systemctl enable typesense
Typesense should now be up and running on your system.
Conclusion
In this tutorial, we have shown you how to install Typesense on Elementary OS Latest, set up a service to start it automatically, and verify that it is running correctly. Typesense has many advanced features, and you can learn more about them by reading the official documentation.