SearxNG

SearxNG (Wikipedia) is a free and open-source metasearch engine which aggregate results from more than 70 search services (e.g. Google, Bing etc.) and to avoid user tracking and profiling by these ones.

There are public instances of searx available, to get a personal practice before you install your own.


License

Searx is released under the GNU Affero General Public License.

Note

For this guide you should be familiar with the uberspace basic concepts of

Prerequisites

Redis needs to be set up.

Installation

Repository Cloning

We will prepare the destination for the searx repository:

[isabell@stardust ~]$ mkdir -p ~/opt/searx/

And clone the repository from GitHub:

[isabell@stardust ~]$ git clone https://github.com/searx/searx.git ~/opt/searx/searxng-src

Setup virtualenv

Note

We are using Python 3.8 instead of the default Python 2 (or the python3 alias, which links to Python 3.6), as some depencencies of searx require this. Once the virtualenv has been activated using the source command below, you can use the usual Python commands without a version postfix.

[isabell@stardust ~]$ python3.8 -m venv ~/opt/searx/searx-pyenv
[isabell@stardust ~]$ source ~/opt/searx/searx-pyenv/bin/activate

Python Module Installation

Some required Python modules are necessary and will be installed in your uberspace with pip3.8 and the options --user, --upgrade and --requirement:

[isabell@stardust ~]$ pip install -U pip
[isabell@stardust ~]$ pip install -U setuptools
[isabell@stardust ~]$ pip install -U wheel
[isabell@stardust ~]$ pip install -U pyyaml
[isabell@stardust ~]$ cd ~/opt/searx/searxng-src/
[isabell@stardust searxng-src]$ pip install -e .

Configuration

We create the configuration file destination directory:

[isabell@stardust ~]$ mkdir ~/etc/searx

And copy the example file with basic default settings to the new directory:

[isabell@stardust ~]$ cp ~/opt/searx/searxng-src/utils/templates/etc/searxng/settings.yml ~/etc/searx/settings.yml

Now it’s time to change some entries in the configuration file ~/etc/searx/settings.yml with your favourite editor. But here are the aspects to consider:

  1. You can change the name of your own searx instance. The standard name is “searx”.

  2. The port with 8888 will not be touched, but keep this number in your mind for later configurtations.

  3. The bind address 0.0.0.0 must be added in the server section, to work with web backends in a common way.

  4. Searx requires for the own instance a secret key. This random number will be created with openssl (16 digits) and please save it temporarily:

[isabell@stardust ~]$ openssl rand -hex 16
012345678901234x
 use_default_settings: True

 general:
     debug : False # Debug mode, only for development
     instance_name : "searx" # displayed name

 search:
     safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict
     autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "swisscows", "qwant", "wikipedia" - leave blank to turn it off by default
     default_lang : "" # Default search language - leave blank to detect from browser information or use codes from 'languages.py'

 server:
     port : 8888
     bind_address : "0.0.0.0" # address to listen on
     secret_key : "012345678901234x" # change this with your own secret key!
     base_url : False # Set custom base_url. Possible values: False or "https://your.custom.host/location/"
     image_proxy : False # Proxying image results through searx

Supervisord Setup

At first we must create the service file ~/etc/services.d/searx.ini with the following content:

[program:searx]
environment=SEARXNG_SETTINGS_PATH="%(ENV_HOME)s/etc/searx/settings.yml"
autostart=yes
autorestart=yes
command=%(ENV_HOME)s/opt/searx/searx-pyenv/bin/python %(ENV_HOME)s/opt/searx/searxng-src/searx/webapp.py
directory=%(ENV_HOME)s/opt/searx/searxng-src
startsecs=10

After creating the configuration, tell supervisord to refresh its configuration and start the service:

[isabell@stardust ~]$ supervisorctl reread
SERVICE: available
[isabell@stardust ~]$ supervisorctl update
SERVICE: added process group
[isabell@stardust ~]$ supervisorctl status
SERVICE                            RUNNING   pid 26020, uptime 0:03:14
[isabell@stardust ~]$

If it’s not in state RUNNING, check your configuration.

Web Backend Setup

Note

Searx is running on port 8888.

To make the application accessible from the outside, configure a web backend:

[isabell@stardust ~]$ uberspace web backend set / --http --port <port>
Set backend for / to port <port>; please make sure something is listening!
You can always check the status of your backend using "uberspace web backend list".
[isabell@stardust ~]$

Debugging

In case of problems, the log file ~/logs/supervisord.log is the first point for you.

Any configuration changes will be considered with a restart of the daemon:

[isabell@stardust ~]$ supervisorctl restart searx

Tuning

The basic configuration is quiet well. Nearly all aspects to change are possible from the searx front-end. These changes will be saved in a cookie, a temporary solution.

If you want to reduce the search services for example by default, than you have to change the standard configuration.

The official documentation is a good address.


Tested with Uberspace 7.9.0.0 and searx 0.18.0

Written by: FM <git.fm@mmw9.de>, Nico Graf <https://uberspace.de>