installation.rst 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. .. _installation:
  2. ============
  3. Installation
  4. ============
  5. .. sidebar:: Searx server setup
  6. - :ref:`installation nginx`
  7. - :ref:`installation apache`
  8. If you do not have any special preferences, it is recommend to use
  9. :ref:`searx.sh`.
  10. .. contents:: Contents
  11. :depth: 2
  12. :local:
  13. :backlinks: entry
  14. .. _installation basic:
  15. Basic installation
  16. ==================
  17. Step by step installation with virtualenv. For Ubuntu, be sure to have enable
  18. universe repository.
  19. Install packages:
  20. .. tabs::
  21. .. group-tab:: Ubuntu / debian
  22. .. code-block:: sh
  23. $ sudo -H apt-get install \
  24. git build-essential
  25. libxslt-dev python3-dev python3-babel \
  26. zlib1g-dev libffi-dev libssl-dev
  27. Install searx:
  28. .. code:: sh
  29. sudo -H useradd searx --system --disabled-password -d /usr/local/searx
  30. sudo -H usermod -a -G shadow $SERVICE_USER
  31. cd /usr/local/searx
  32. sudo -H git clone https://github.com/asciimoo/searx.git searx-src
  33. sudo -H chown searx:searx -R /usr/local/searx
  34. Install virtualenv:
  35. .. code:: sh
  36. sudo -H -u searx -i
  37. (searx)$ python3 -m venv searx-pyenv
  38. (searx)$ echo 'source ~/searx-pyenv/bin/activate' > ~/.profile
  39. Exit the searx bash and restart a new to install the searx dependencies:
  40. .. code:: sh
  41. sudo -H -u searx -i
  42. (searx)$ cd searx-src
  43. (searx)$ ./manage.sh update_packages
  44. Configuration
  45. ==============
  46. .. code:: sh
  47. sudo -H -u searx -i
  48. (searx)$ cd searx-src
  49. (searx)$ sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml
  50. Edit searx/settings.yml if necessary.
  51. Check
  52. =====
  53. Start searx:
  54. .. code:: sh
  55. sudo -H -u searx -i
  56. (searx)$ cd searx-src
  57. (searx)$ python3 searx/webapp.py
  58. Go to http://localhost:8888
  59. If everything works fine, disable the debug option in settings.yml:
  60. .. code:: sh
  61. sed -i -e "s/debug : True/debug : False/g" searx/settings.yml
  62. At this point searx is not demonized ; uwsgi allows this. You can exit the
  63. virtualenv and the searx user bash (enter exit command twice).
  64. uwsgi
  65. =====
  66. Install packages:
  67. .. tabs::
  68. .. group-tab:: Ubuntu / debian
  69. .. code-block:: bash
  70. sudo -H apt-get install uwsgi uwsgi-plugin-python3
  71. Create the configuration file ``/etc/uwsgi/apps-available/searx.ini`` with this
  72. content:
  73. .. code:: ini
  74. [uwsgi]
  75. # uWSGI core
  76. # ----------
  77. #
  78. # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core
  79. # Who will run the code
  80. uid = searx
  81. gid = searx
  82. # chdir to specified directory before apps loading
  83. chdir = /usr/local/searx/searx-src/searx
  84. # disable logging for privacy
  85. disable-logging = true
  86. # The right granted on the created socket
  87. chmod-socket = 666
  88. # Plugin to use and interpretor config
  89. single-interpreter = true
  90. # enable master process
  91. master = true
  92. # load apps in each worker instead of the master
  93. lazy-apps = true
  94. # load uWSGI plugins
  95. plugin = python3,http
  96. # By default the Python plugin does not initialize the GIL. This means your
  97. # app-generated threads will not run. If you need threads, remember to enable
  98. # them with enable-threads. Running uWSGI in multithreading mode (with the
  99. # threads options) will automatically enable threading support. This *strange*
  100. # default behaviour is for performance reasons.
  101. enable-threads = true
  102. # plugin: python
  103. # --------------
  104. #
  105. # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python
  106. # load a WSGI module
  107. module = searx.webapp
  108. # set PYTHONHOME/virtualenv
  109. virtualenv = /usr/local/searx/searx-pyenv
  110. # add directory (or glob) to pythonpath
  111. pythonpath = /usr/local/searx/searx-src
  112. # plugin http
  113. # -----------
  114. #
  115. # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http
  116. # Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html
  117. http = 127.0.0.1:8888
  118. Activate the uwsgi application and restart:
  119. .. code:: sh
  120. cd /etc/uwsgi/apps-enabled
  121. ln -s ../apps-available/searx.ini
  122. /etc/init.d/uwsgi restart
  123. How to update
  124. =============
  125. .. code:: sh
  126. sudo -H -u searx -i
  127. (searx)$ git stash
  128. (searx)$ git pull origin master
  129. (searx)$ git stash apply
  130. (searx)$ ./manage.sh update_packages
  131. Restart uwsgi:
  132. .. tabs::
  133. .. group-tab:: Ubuntu / debian
  134. .. code:: sh
  135. sudo -H systemctl restart uwsgi
  136. Docker
  137. ======
  138. Make sure you have installed Docker. For instance, you can deploy searx like this:
  139. .. code:: sh
  140. docker pull wonderfall/searx
  141. docker run -d --name searx -p $PORT:8888 wonderfall/searx
  142. Go to ``http://localhost:$PORT``.
  143. See https://hub.docker.com/r/wonderfall/searx/ for more informations. It's also
  144. possible to build searx from the embedded Dockerfile.
  145. .. code:: sh
  146. git clone https://github.com/asciimoo/searx.git
  147. cd searx
  148. docker build -t whatever/searx .
  149. References
  150. ==========
  151. * https://about.okhin.fr/posts/Searx/ with some additions
  152. * How to: `Setup searx in a couple of hours with a free SSL certificate
  153. <https://www.reddit.com/r/privacytoolsIO/comments/366kvn/how_to_setup_your_own_privacy_respecting_search/>`__