How to install SearX Search Engine on Ubuntu

Searx is a decentralized and non-commercial search engine that respects user’s privacy. It is one of the best and free private search engines that aggregate results from more than 70 search services, including Google and Bing. It does not track or collect user’s data.

But the question is this why we need to have our own private search instance. The answer is this because public instances do not respect the user's privacy. They are operated by unknown parties, and you have to completely rely on them. They may even log, aggregate, and sell user's web request and data without letting them know and also sell this data to a third party. However, if you run your private instance, everything will be in your control, including the logging data, confidential data, and the source code. And you can achieve all these features with Searx.

How Searx works

When you submit any search query, Searx sends it to 70 search engines, then gathers data and rank them. It runs without any database and does not log IP addresses, stores past queries and personal data for selling to a third party.

It protects the user’s privacy by removing the private data from the search requests in the following ways:

  • It removes the private data from the requests that are sent to search engines.
  • It does not forward anything (e.g. advertisement) from a third party.
  • It removes the private data from the requests that are sent to the result pages.

In this article, we will explain how to install Searx in Ubuntu 20.04. Searx is open-source and easy to set up for hosting private or public instance. Here are some of the features of Searx:

Features

  • Self-hosting
  • No user tracking
  • No user profiling
  • About 70 supported search engines
  • Easy integration of other search engines
  • Cookies are not used by default
  • Secure, encrypted connections (HTTPS/SSL)
  • Can proxy web pages
  • Can be set as default search engine
  • Customizable (theme, search settings, privacy settings)
  • Different search languages

We will use Ubuntu 20.04 LTS for describing the procedure mentioned in this article. Let's move towards installation.

Installation

Before installing Searx, make sure the system is fully updated and upgraded. To do so, launch the Terminal by using Ctrl+Alt+T key shortcut and then type the following command in it:

$sudo apt-get update –y

If prompted, enter sudo password.

Update package lists

Now run the following command:

$ sudo apt-get upgrade -y

Update packages

Install dependencies

To install Searx, we will need to install some dependencies. Instead of installing these dependenciesonce the dc one by one, we install all of them by running the following command in Terminal:

$ sudo apt-get install git build-essential python-babel zlib1g-dev libffi-dev libssl-dev libxslt-dev python-dev python-virtualenv -y

Install Dependencies

Install Searx

Now we will need to download the latest version of Searx Git repository. To do so, navigate to a directory where you want to download it.

$ cd /opt/

Then run the following command:

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

Install Searx

Configure Searx web access

To access the Serax from the within the network, we can use its private IP. We can also configure Serax to access it from the remote system. For that, we will need to enter its public IP.

However, for now, we will configure to access it from private IP. For that, we will need to edit the settings.yml file.  Run the following command in Terminal to edit the file in Nano editor :

$ sudo nano /opt/searx/searx/settings.yml

Searx Settings

When the file opens, replace the IP address by your server private or public IP address by changing the lines under server section:

Change from bind_address : "127.0.0.1" to bind_address : "192.168.72.150"

Replace 192.168.72.150 with the private or public IP of your system. Leave the port 8888 as the default port for accessing the web interface.

Once you have done with the editing, press Ctrl+O to save the configuration file and Ctrl + X to exit the editor.

Bind address

Note that if you want to access the Searx web page from your own local system, you do not have to perform the above step. And in that case, you can access the web page by using the default address 127.0.0.1.

Activate Searx

Once you have successfully completed the above steps, then you will need to activate the Searx virtual environment.

To do so, navigate to the Searx directory by using the following cd command:

$ cd /opt/searx

Activate Searx

Then run the following commands in Terminal to activate Serax virtual environment:

$ sudo virtualenv -p python3 searx-ve
$ . ./searx-ve/bin/activate
$ pip3 install -r requirements.txt

Searx VE

Update Searx

Once done with the activation, we will need to update the Serax. For that, run the following command in Terminal:

$ sudo ./manage.sh update_packages

Update Searx

Wait for a while until the Searx is fully updated.

Launch Searx

Now start the Searx by running the following command in Terminal:

$ python3 searx/webapp.py

Launch Searx

Access Searx

As we have configured Searx to listen on IP address 192.168.72.150 and port 8888. So we will use this address and port to access the web interface. Open any browser and type the following address in the address bar of your browser.

http://ip-address:8888

Replace the ip-address by the IP address of your system.

By typing the above address in your browser, you will see the following default Searx page.

SearX Search Engine

Searx will continue to work until you close the Terminal. There is a way to get around this. Press Ctrl+C so that the current session is stopped. Then run the following command in terminal:

$ nohup python3 searx/webapp.py &

By doing this, Searx will continue to run in the background even if you close the Terminal.

We have learned how to install Searx on Ubuntu 20.04 LTS. You can see how easy it was to install and setup it on your system. Now you can also set it as your browser’s default search engine.