installation.rst.txt 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. .. _installation:
  2. Installation
  3. ============
  4. .. contents::
  5. :depth: 3
  6. Basic installation
  7. ------------------
  8. Step by step installation for Debian/Ubuntu with virtualenv. For Ubuntu, be sure to have enable universe repository.
  9. Install packages:
  10. .. code:: sh
  11. sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv virtualenv python-babel zlib1g-dev libffi-dev libssl-dev
  12. Install searx:
  13. .. code:: sh
  14. cd /usr/local
  15. sudo git clone https://github.com/asciimoo/searx.git
  16. sudo useradd searx -d /usr/local/searx
  17. sudo chown searx:searx -R /usr/local/searx
  18. Install dependencies in a virtualenv:
  19. .. code:: sh
  20. sudo -u searx -i
  21. cd /usr/local/searx
  22. virtualenv searx-ve
  23. . ./searx-ve/bin/activate
  24. ./manage.sh update_packages
  25. Configuration
  26. -------------
  27. .. code:: sh
  28. sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml
  29. Edit searx/settings.yml if necessary.
  30. Check
  31. -----
  32. Start searx:
  33. .. code:: sh
  34. python searx/webapp.py
  35. Go to http://localhost:8888
  36. If everything works fine, disable the debug option in settings.yml:
  37. .. code:: sh
  38. sed -i -e "s/debug : True/debug : False/g" searx/settings.yml
  39. At this point searx is not demonized ; uwsgi allows this.
  40. You can exit the virtualenv and the searx user bash (enter exit command
  41. twice).
  42. uwsgi
  43. -----
  44. Install packages:
  45. .. code:: sh
  46. sudo apt-get install uwsgi uwsgi-plugin-python
  47. Create the configuration file /etc/uwsgi/apps-available/searx.ini with
  48. this content:
  49. ::
  50. [uwsgi]
  51. # Who will run the code
  52. uid = searx
  53. gid = searx
  54. # disable logging for privacy
  55. disable-logging = true
  56. # Number of workers (usually CPU count)
  57. workers = 4
  58. # The right granted on the created socket
  59. chmod-socket = 666
  60. # Plugin to use and interpretor config
  61. single-interpreter = true
  62. master = true
  63. plugin = python
  64. lazy-apps = true
  65. enable-threads = true
  66. # Module to import
  67. module = searx.webapp
  68. # Virtualenv and python path
  69. virtualenv = /usr/local/searx/searx-ve/
  70. pythonpath = /usr/local/searx/
  71. chdir = /usr/local/searx/searx/
  72. Activate the uwsgi application and restart:
  73. .. code:: sh
  74. cd /etc/uwsgi/apps-enabled
  75. ln -s ../apps-available/searx.ini
  76. /etc/init.d/uwsgi restart
  77. Web server
  78. ----------
  79. with nginx
  80. ^^^^^^^^^^
  81. If nginx is not installed (uwsgi will not work with the package
  82. nginx-light):
  83. .. code:: sh
  84. sudo apt-get install nginx
  85. Hosted at /
  86. """""""""""
  87. Create the configuration file /etc/nginx/sites-available/searx with this
  88. content:
  89. .. code:: nginx
  90. server {
  91. listen 80;
  92. server_name searx.example.com;
  93. root /usr/local/searx;
  94. location / {
  95. include uwsgi_params;
  96. uwsgi_pass unix:/run/uwsgi/app/searx/socket;
  97. }
  98. }
  99. Restart service:
  100. .. code:: sh
  101. sudo service nginx restart
  102. sudo service uwsgi restart
  103. from subdirectory URL (/searx)
  104. """"""""""""""""""""""""""""""
  105. Add this configuration in the server config file
  106. /etc/nginx/sites-enabled/default:
  107. .. code:: nginx
  108. location = /searx { rewrite ^ /searx/; }
  109. location /searx {
  110. try_files $uri @searx;
  111. }
  112. location @searx {
  113. uwsgi_param SCRIPT_NAME /searx;
  114. include uwsgi_params;
  115. uwsgi_modifier1 30;
  116. uwsgi_pass unix:/run/uwsgi/app/searx/socket;
  117. }
  118. OR
  119. using reverse proxy
  120. (Please, note that reverse proxy advised to be used in case of single-user or low-traffic instances.)
  121. .. code:: nginx
  122. location /searx {
  123. proxy_pass http://127.0.0.1:8888;
  124. proxy_set_header Host $host;
  125. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  126. proxy_set_header X-Scheme $scheme;
  127. proxy_set_header X-Script-Name /searx;
  128. proxy_buffering off;
  129. }
  130. Enable base\_url in searx/settings.yml
  131. ::
  132. base_url : http://your.domain.tld/searx/
  133. Restart service:
  134. .. code:: sh
  135. sudo service nginx restart
  136. sudo service uwsgi restart
  137. disable logs
  138. ~~~~~~~~~~~~
  139. for better privacy you can disable nginx logs about searx.
  140. how to proceed: below ``uwsgi_pass`` in
  141. /etc/nginx/sites-available/default add
  142. ::
  143. access_log /dev/null;
  144. error_log /dev/null;
  145. Restart service:
  146. .. code:: sh
  147. sudo service nginx restart
  148. with apache
  149. ^^^^^^^^^^^
  150. Add wsgi mod:
  151. .. code:: sh
  152. sudo apt-get install libapache2-mod-uwsgi
  153. sudo a2enmod uwsgi
  154. Add this configuration in the file /etc/apache2/apache2.conf:
  155. .. code:: apache
  156. <Location />
  157. Options FollowSymLinks Indexes
  158. SetHandler uwsgi-handler
  159. uWSGISocket /run/uwsgi/app/searx/socket
  160. </Location>
  161. Note that if your instance of searx is not at the root, you should
  162. change ``<Location />`` by the location of your instance, like
  163. ``<Location /searx>``.
  164. Restart Apache:
  165. .. code:: sh
  166. sudo /etc/init.d/apache2 restart
  167. disable logs
  168. """"""""""""
  169. For better privacy you can disable Apache logs.
  170. WARNING: not tested
  171. WARNING: you can only disable logs for the whole (virtual) server not
  172. for a specific path.
  173. Go back to /etc/apache2/apache2.conf and above ``<Location />`` add:
  174. .. code:: apache
  175. CustomLog /dev/null combined
  176. Restart Apache:
  177. .. code:: sh
  178. sudo /etc/init.d/apache2 restart
  179. How to update
  180. -------------
  181. .. code:: sh
  182. cd /usr/local/searx
  183. sudo -u searx -i
  184. . ./searx-ve/bin/activate
  185. git stash
  186. git pull origin master
  187. git stash apply
  188. ./manage.sh update_packages
  189. sudo service uwsgi restart
  190. Docker
  191. ------
  192. Make sure you have installed Docker. For instance, you can deploy searx like this:
  193. .. code:: sh
  194. docker pull wonderfall/searx
  195. docker run -d --name searx -p $PORT:8888 wonderfall/searx
  196. Go to http://localhost:$PORT.
  197. See https://hub.docker.com/r/wonderfall/searx/ for more informations.
  198. It's also possible to build searx from the embedded Dockerfile.
  199. .. code:: sh
  200. git clone https://github.com/asciimoo/searx.git
  201. cd searx
  202. docker build -t whatever/searx .
  203. References
  204. ==========
  205. * https://about.okhin.fr/posts/Searx/ with some additions
  206. * 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/>`__