| 
									
										
										
										
											2016-07-15 18:41:05 +02:00
										 |  |  | .. _installation:
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  | ============
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | Installation
 | 
					
						
							|  |  |  | ============
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  | .. sidebar:: Searx server setup
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    - :ref:`installation nginx`
 | 
					
						
							|  |  |  |    - :ref:`installation apache`
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    If you do not have any special preferences, it is recommend to use
 | 
					
						
							|  |  |  |    :ref:`searx.sh`.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. contents:: Contents
 | 
					
						
							|  |  |  |    :depth: 2
 | 
					
						
							|  |  |  |    :local: | 
					
						
							|  |  |  |    :backlinks: entry
 | 
					
						
							| 
									
										
										
										
											2016-01-10 20:10:53 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 13:13:17 +01:00
										 |  |  | .. _installation basic:
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | Basic installation
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  | ==================
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  | Step by step installation with virtualenv.  For Ubuntu, be sure to have enable
 | 
					
						
							|  |  |  | universe repository.
 | 
					
						
							| 
									
										
										
										
											2020-02-04 13:13:17 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  | Install packages:
 | 
					
						
							| 
									
										
										
										
											2020-02-04 13:13:17 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  | .. tabs::
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    .. group-tab:: Ubuntu / debian
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |       .. code-block:: sh
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |          $ sudo -H apt-get install \
 | 
					
						
							|  |  |  |                    git build-essential
 | 
					
						
							|  |  |  |                    libxslt-dev python3-dev python3-babel \
 | 
					
						
							|  |  |  |                    zlib1g-dev libffi-dev libssl-dev
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-10 20:10:53 +01:00
										 |  |  | Install searx:
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |     sudo -H useradd searx --system --disabled-password -d /usr/local/searx
 | 
					
						
							| 
									
										
										
										
											2020-02-08 13:24:08 +01:00
										 |  |  |     sudo -H usermod -a -G shadow searx
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |     cd /usr/local/searx
 | 
					
						
							|  |  |  |     sudo -H git clone https://github.com/asciimoo/searx.git searx-src
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  |     sudo -H chown searx:searx -R /usr/local/searx
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  | Install virtualenv:
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  |     sudo -H -u searx -i
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |     (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:
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |     sudo -H -u searx -i
 | 
					
						
							|  |  |  |     (searx)$ cd searx-src
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  |     (searx)$ ./manage.sh update_packages
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | Configuration
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  | ==============
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |     sudo -H -u searx -i
 | 
					
						
							|  |  |  |     (searx)$ cd searx-src
 | 
					
						
							|  |  |  |     (searx)$ sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | Edit searx/settings.yml if necessary.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Check
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  | =====
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-10 20:10:53 +01:00
										 |  |  | Start searx:
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |     sudo -H -u searx -i
 | 
					
						
							|  |  |  |     (searx)$ cd searx-src
 | 
					
						
							|  |  |  |     (searx)$ python3 searx/webapp.py
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | Go to http://localhost:8888
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-10 20:10:53 +01:00
										 |  |  | If everything works fine, disable the debug option in settings.yml:
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     sed -i -e "s/debug : True/debug : False/g" searx/settings.yml
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  | At this point searx is not demonized ; uwsgi allows this.  You can exit the
 | 
					
						
							|  |  |  | virtualenv and the searx user bash (enter exit command twice).
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | uwsgi
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  | =====
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-10 20:10:53 +01:00
										 |  |  | Install packages:
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  | .. tabs::
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    .. group-tab:: Ubuntu / debian
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |       .. code-block:: bash
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |          sudo -H apt-get install uwsgi uwsgi-plugin-python3
 | 
					
						
							| 
									
										
										
										
											2019-12-31 14:24:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  | Create the configuration file ``/etc/uwsgi/apps-available/searx.ini`` with this
 | 
					
						
							| 
									
										
										
										
											2016-01-10 20:10:53 +01:00
										 |  |  | content:
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  | .. code:: ini
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    [uwsgi]
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # uWSGI core
 | 
					
						
							|  |  |  |    # ----------
 | 
					
						
							|  |  |  |    #
 | 
					
						
							|  |  |  |    # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # Who will run the code
 | 
					
						
							|  |  |  |    uid = searx
 | 
					
						
							|  |  |  |    gid = searx
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # chdir to specified directory before apps loading
 | 
					
						
							|  |  |  |    chdir = /usr/local/searx/searx-src/searx
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # disable logging for privacy
 | 
					
						
							|  |  |  |    disable-logging = true
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # The right granted on the created socket
 | 
					
						
							|  |  |  |    chmod-socket = 666
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # Plugin to use and interpretor config
 | 
					
						
							|  |  |  |    single-interpreter = true
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # enable master process
 | 
					
						
							|  |  |  |    master = true
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # load apps in each worker instead of the master
 | 
					
						
							|  |  |  |    lazy-apps = true
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # load uWSGI plugins
 | 
					
						
							|  |  |  |    plugin = python3,http
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # 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
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # plugin: python
 | 
					
						
							|  |  |  |    # --------------
 | 
					
						
							|  |  |  |    #
 | 
					
						
							|  |  |  |    # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # load a WSGI module
 | 
					
						
							|  |  |  |    module = searx.webapp
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # set PYTHONHOME/virtualenv
 | 
					
						
							|  |  |  |    virtualenv = /usr/local/searx/searx-pyenv
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # add directory (or glob) to pythonpath
 | 
					
						
							|  |  |  |    pythonpath = /usr/local/searx/searx-src
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # plugin http
 | 
					
						
							|  |  |  |    # -----------
 | 
					
						
							|  |  |  |    #
 | 
					
						
							|  |  |  |    # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |    # Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html
 | 
					
						
							|  |  |  |    http = 127.0.0.1:8888
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  | Activate the uwsgi application and restart:
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |     cd /etc/uwsgi/apps-enabled
 | 
					
						
							|  |  |  |     ln -s ../apps-available/searx.ini
 | 
					
						
							|  |  |  |     /etc/init.d/uwsgi restart
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | How to update
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  | =============
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  |     sudo -H -u searx -i
 | 
					
						
							|  |  |  |     (searx)$ git stash
 | 
					
						
							|  |  |  |     (searx)$ git pull origin master
 | 
					
						
							|  |  |  |     (searx)$ git stash apply
 | 
					
						
							|  |  |  |     (searx)$ ./manage.sh update_packages
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  | Restart uwsgi:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. tabs::
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    .. group-tab:: Ubuntu / debian
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .. code:: sh
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-04 16:42:13 +01:00
										 |  |  |          sudo -H systemctl restart uwsgi
 | 
					
						
							| 
									
										
										
										
											2015-11-17 23:13:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-10 20:10:53 +01:00
										 |  |  | Docker
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  | ======
 | 
					
						
							| 
									
										
										
										
											2016-01-10 20:10:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | Make sure you have installed Docker. For instance, you can deploy searx like this:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     docker pull wonderfall/searx
 | 
					
						
							|  |  |  |     docker run -d --name searx -p $PORT:8888 wonderfall/searx
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  | Go to ``http://localhost:$PORT``.
 | 
					
						
							| 
									
										
										
										
											2016-01-10 20:10:53 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  | See https://hub.docker.com/r/wonderfall/searx/ for more informations.  It's also
 | 
					
						
							|  |  |  | possible to build searx from the embedded Dockerfile.
 | 
					
						
							| 
									
										
										
										
											2016-01-10 20:10:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  |    git clone https://github.com/asciimoo/searx.git
 | 
					
						
							|  |  |  |    cd searx
 | 
					
						
							|  |  |  |    docker build -t whatever/searx .
 | 
					
						
							| 
									
										
										
										
											2016-11-20 21:12:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | References
 | 
					
						
							|  |  |  | ==========
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  | * https://about.okhin.fr/posts/Searx/ with some additions
 | 
					
						
							| 
									
										
										
										
											2016-11-20 21:12:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-04 17:54:41 +01:00
										 |  |  | * How to: `Setup searx in a couple of hours with a free SSL certificate
 | 
					
						
							|  |  |  |   <https://www.reddit.com/r/privacytoolsIO/comments/366kvn/how_to_setup_your_own_privacy_respecting_search/>`__
 |