How to Install Searx on Ubuntu 18.04

Updated on November 1, 2018
How to Install Searx on Ubuntu 18.04 header image

Searx is an open-source, free to use metasearch engine that aggregates results from more than 70 search services, including Google and Bing. The application doesn't collect data from users, and can be installed on your own server fairly easily.

This guide aims to teach you how to install and configure Searx locally, quickly and securely.

Prerequisites

Before we begin, you'll need the following:

  • A VPS with Ubuntu 18.04 or later installed.
  • Access to the root user

Before you begin

Once you've got the necessary requirements, proceed to login to your VPS, making sure to use a root user. Running anything as root can be extremely dangerous, so make sure to take care when running commands. Once you've logged in we're going to update our repositories:

sudo apt-get update && sudo apt-get upgrade

Reboot your VPS and get ready to start the installation.

Install dependencies

Searx requires quite a few dependencies. Enter the following into the terminal to start the installation:

sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-babel zlib1g-dev libffi-dev libssl-dev
  • git - Necessary to copy the source code from GitHub
  • build-essential - Contains references to numerous packages needed for building software in general
  • libxslt-dev, python-dev, python-babel - Necessary for python
  • zlib1g-dev - A compression library
  • libffi-dev - An interface library
  • libssl-dev - SSL toolkit for Searx

Setup installation directory

After installing the dependencies above, we can move to the directory that we'll install Searx in:

cd /usr/local/

Next, we'll use git to download a copy of the Searx source code:

sudo git clone https://github.com/asciimoo/searx.git

Now we're going to create a new user for Searx to use and assign it directory privileges:

sudo useradd searx -d /usr/local/searx
sudo chown searx:searx -R /usr/local/searx

Build Searx

Now that we've installed dependencies and set up our installation directory we can begin building Searx.

First, lets move to the directory we created when downloading the source code:

cd searx/

Next, we'll switch to our newly created user:

sudo -u searx -i

Once we're logged in, we can configure and activate the Searx virtual environment. This allows Searx to run within its own environment so we can ensure that it runs properly without restrictions. Enter the following commands to activate the environment:

virtualenv searx-ve
. ./searx-ve/bin/activate

When the virtual environment finishes installing, we're going to use the included shell script to update Searx. This can be done by running the command below:

./manage.sh update_packages

Launch Searx

Now we can launch the main Searx program with Python:

python searx/webapp.py

Searx will continue to run until the terminal window is closed. You'll probably want to get around this and allow it to run indefinitly, even when you aren't connected your VPS. This can be done by running the application in the background.

Press Ctrl + C to stop the current instance from running and then enter the command below:

nohup python searx/webapp.py &

Now that you've got Searx installed and setup you will be able to browse the web privately. You can view your installation at SERVER_IP:8888. I recommend adding a domain to your server if you want to make access easier.

More configuration options can be found here.