Searx

Searx (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

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/

Python Module Installation

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. For this reason, all pip and python commands need a version postfix 3.8 like below. (3.9 should work as well.)

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 ~]$ pip3.8 install --user --upgrade --requirement ~/opt/searx/requirements.txt

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/utils/templates/etc/searx/use_default_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 must be changed to 0.0.0.0, 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=SEARX_SETTINGS_PATH="%(ENV_HOME)s/etc/searx/settings.yml"
autostart=yes
autorestart=yes
command=python3.8 %(ENV_HOME)s/opt/searx/searx/webapp.py

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. A bigger configuration file example is available at ~/opt/searx/searx/setting.yml.


Tested with Uberspace 7.9.0.0 and searx 0.18.0

Written by: FM <git.fm@mmw9.de>