searxng/docs/admin/installation.rst
Markus Heiser eedd63ccd5 docs: revision of the installation instructions
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-02-04 16:42:13 +01:00

5.1 KiB

Installation

Searx server setup

  • installation nginx
  • installation apache

If you do not have any special preferences, it is recommend to use searx.sh.

Contents

Basic installation

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

Install packages:

Ubuntu / debian

$ sudo -H apt-get install \
          git build-essential
          libxslt-dev python3-dev python3-babel \
          zlib1g-dev libffi-dev libssl-dev

Install searx:

sudo -H useradd searx --system --disabled-password -d /usr/local/searx
sudo -H usermod -a -G shadow $SERVICE_USER
cd /usr/local/searx
sudo -H git clone https://github.com/asciimoo/searx.git searx-src
sudo -H chown searx:searx -R /usr/local/searx

Install virtualenv:

sudo -H -u searx -i
(searx)$ python3 -m venv searx-pyenv
(searx)$ echo 'source ~/searx-pyenv/bin/activate' > ~/.profile

Exit the searx bash and restart a new to install the searx dependencies:

sudo -H -u searx -i
(searx)$ cd searx-src
(searx)$ ./manage.sh update_packages

Configuration

sudo -H -u searx -i
(searx)$ cd searx-src
(searx)$ sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml

Edit searx/settings.yml if necessary.

Check

Start searx:

sudo -H -u searx -i
(searx)$ cd searx-src
(searx)$ python3 searx/webapp.py

Go to http://localhost:8888

If everything works fine, disable the debug option in settings.yml:

sed -i -e "s/debug : True/debug : False/g" searx/settings.yml

At this point searx is not demonized ; uwsgi allows this. You can exit the virtualenv and the searx user bash (enter exit command twice).

uwsgi

Install packages:

Ubuntu / debian

sudo -H apt-get install uwsgi uwsgi-plugin-python3

Create the configuration file /etc/uwsgi/apps-available/searx.ini with this content:

[uwsgi]

# uWSGI core
# ----------
#
# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core

# Who will run the code
uid = searx
gid = searx

# chdir to specified directory before apps loading
chdir = /usr/local/searx/searx-src/searx

# disable logging for privacy
disable-logging = true

# The right granted on the created socket
chmod-socket = 666

# Plugin to use and interpretor config
single-interpreter = true

# enable master process
master = true

# load apps in each worker instead of the master
lazy-apps = true

# load uWSGI plugins
plugin = python3,http

# By default the Python plugin does not initialize the GIL.  This means your
# app-generated threads will not run.  If you need threads, remember to enable
# them with enable-threads.  Running uWSGI in multithreading mode (with the
# threads options) will automatically enable threading support. This *strange*
# default behaviour is for performance reasons.
enable-threads = true

# plugin: python
# --------------
#
# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python

# load a WSGI module
module = searx.webapp

# set PYTHONHOME/virtualenv
virtualenv = /usr/local/searx/searx-pyenv

# add directory (or glob) to pythonpath
pythonpath = /usr/local/searx/searx-src


# plugin http
# -----------
#
# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http

# Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html
http = 127.0.0.1:8888

Activate the uwsgi application and restart:

cd /etc/uwsgi/apps-enabled
ln -s ../apps-available/searx.ini
/etc/init.d/uwsgi restart

How to update

sudo -H -u searx -i
(searx)$ git stash
(searx)$ git pull origin master
(searx)$ git stash apply
(searx)$ ./manage.sh update_packages

Restart uwsgi:

Ubuntu / debian

sudo -H systemctl restart uwsgi

Docker

Make sure you have installed Docker. For instance, you can deploy searx like this:

docker pull wonderfall/searx
docker run -d --name searx -p $PORT:8888 wonderfall/searx

Go to http://localhost:$PORT.

See https://hub.docker.com/r/wonderfall/searx/ for more informations. It's also possible to build searx from the embedded Dockerfile.

git clone https://github.com/asciimoo/searx.git
cd searx
docker build -t whatever/searx .

References