Step by step installation

Step by step installation with virtualenv. For Ubuntu, be sure to have enable universe repository.

Install packages

$ sudo -H apt-get install -y \
    virtualenv python3-dev python3-babel python3-venv \
    uwsgi uwsgi-plugin-python3 \
    git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev \
    shellcheck
$ sudo -H pacman -S --noconfirm \
    python-virtualenv python python-pip python-lxml python-babel \
    uwsgi uwsgi-plugin-python \
    git base-devel libxml2 \
    shellcheck
$ sudo -H dnf install -y \
    virtualenv python python-pip python-lxml python-babel \
    uwsgi uwsgi-plugin-python3 \
    git @development-tools libxml2 \
    ShellCheck

Hint

This installs also the packages needed by uwsgi

Create user

$ sudo -H useradd --shell /bin/bash --system \
    --home-dir /usr/local/searx \
    --comment 'Privacy-respecting metasearch engine' searx

$ sudo -H mkdir /usr/local/searx
$ sudo -H chown -R searx:searx /usr/local/searx

install searx & dependencies

Start a interactive shell from new created user and clone searx:

$ sudo -H -u searx -i
(searx)$ git clone https://github.com/asciimoo/searx.git /usr/local/searx/searx-src

In the same shell create virtualenv:

(searx)$ python3 -m venv /usr/local/searx/searx-pyenv
(searx)$ echo . /usr/local/searx/searx-pyenv/bin/activate >>  /usr/local/searx/.profile

To install searx’s dependencies, exit the searx bash session you opened above and restart a new. Before install, first check if your virualenv was sourced from the login (~/.profile):

$ sudo -H -u searx -i

(searx)$ command -v python && python --version
/usr/local/searx/searx-pyenv/bin/python
Python 3.8.1

# update pip's boilerplate ..
pip install -U pip
pip install -U setuptools
pip install -U wheel

# jump to searx's working tree and install searx into virtualenv
(searx)$ cd /usr/local/searx/searx-src
(searx)$ pip install -e .

Tip

Open a second terminal for the configuration tasks and left the (searx)$ terminal open for the tasks below.

Configuration

Create a copy of the git://searx/settings.yml configuration file in system’s /etc folder. Configure like shown below – replace searx@\$(uname -n) with a name of your choice – and/or edit /etc/searx/settings.yml if necessary.

$ sudo -H cp /usr/local/searx/searx-src/searx/settings.yml /etc/searx/settings.yml
$ sudo -H sed -i -e s/ultrasecretkey/\367ed0f4f4f300bd1457e5c87d036ab2/g /etc/searx/settings.yml
$ sudo -H sed -i -e s/{instance_name}/searx@\ryzen/g /etc/searx/settings.yml

Check

To check your searx setup, optional enable debugging and start the webapp. Searx looks at the exported environment $SEARX_SETTINGS_PATH for a configuration file.

# enable debug ..
$ sudo -H sed -i -e s/debug : False/debug : True/g /etc/searx/settings.yml

# start webapp
$ sudo -H -u searx -i
(searx)$ cd /usr/local/searx/searx-src
(searx)$ export SEARX_SETTINGS_PATH=/etc/searx/settings.yml
(searx)$ python searx/webapp.py

# disable debug
$ sudo -H sed -i -e s/debug : True/debug : False/g /etc/searx/settings.yml

Open WEB browser and visit http:// . If you are inside a container or in a script, test with curl:

$ xgd-open http://
$ curl --location --verbose --head --insecure

*   Trying 127.0.0.1:8888...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8888 (#0)
> HEAD / HTTP/1.1
> Host: 127.0.0.1:8888
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
HTTP/1.0 200 OK
...

If everything works fine, hit [CTRL-C] to stop the webapp and disable the debug option in settings.yml. You can now exit searx user bash (enter exit command twice). At this point searx is not demonized; uwsgi allows this.