installation.txt 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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 python-pybabel 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. # Module to import
  65. module = searx.webapp
  66. # Virtualenv and python path
  67. virtualenv = /usr/local/searx/searx-ve/
  68. pythonpath = /usr/local/searx/
  69. chdir = /usr/local/searx/searx/
  70. Activate the uwsgi application and restart:
  71. .. code:: sh
  72. cd /etc/uwsgi/apps-enabled
  73. ln -s ../apps-available/searx.ini
  74. /etc/init.d/uwsgi restart
  75. Web server
  76. ----------
  77. with nginx
  78. ^^^^^^^^^^
  79. If nginx is not installed (uwsgi will not work with the package
  80. nginx-light):
  81. .. code:: sh
  82. sudo apt-get install nginx
  83. Hosted at /
  84. """""""""""
  85. Create the configuration file /etc/nginx/sites-available/searx with this
  86. content:
  87. .. code:: nginx
  88. server {
  89. listen 80;
  90. server_name searx.example.com;
  91. root /usr/local/searx;
  92. location / {
  93. include uwsgi_params;
  94. uwsgi_pass unix:/run/uwsgi/app/searx/socket;
  95. }
  96. }
  97. Restart service:
  98. .. code:: sh
  99. sudo service nginx restart
  100. sudo service uwsgi restart
  101. from subdirectory URL (/searx)
  102. """"""""""""""""""""""""""""""
  103. Add this configuration in the server config file
  104. /etc/nginx/sites-enabled/default:
  105. .. code:: nginx
  106. location = /searx { rewrite ^ /searx/; }
  107. location /searx {
  108. try_files $uri @searx;
  109. }
  110. location @searx {
  111. uwsgi_param SCRIPT_NAME /searx;
  112. include uwsgi_params;
  113. uwsgi_modifier1 30;
  114. uwsgi_pass unix:/run/uwsgi/app/searx/socket;
  115. }
  116. OR
  117. using reverse proxy
  118. (Please, note that reverse proxy advised to be used in case of single-user or low-traffic instances.)
  119. .. code:: nginx
  120. location /searx {
  121. proxy_pass http://127.0.0.1:8888;
  122. proxy_set_header Host $host;
  123. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  124. proxy_set_header X-Scheme $scheme;
  125. proxy_set_header X-Script-Name /searx;
  126. proxy_buffering off;
  127. }
  128. Enable base\_url in searx/settings.yml
  129. ::
  130. base_url : http://your.domain.tld/searx/
  131. Restart service:
  132. .. code:: sh
  133. sudo service nginx restart
  134. sudo service uwsgi restart
  135. disable logs
  136. ~~~~~~~~~~~~
  137. for better privacy you can disable nginx logs about searx.
  138. how to proceed: below ``uwsgi_pass`` in
  139. /etc/nginx/sites-available/default add
  140. ::
  141. access_log /dev/null;
  142. error_log /dev/null;
  143. Restart service:
  144. .. code:: sh
  145. sudo service nginx restart
  146. with apache
  147. ^^^^^^^^^^^
  148. Add wsgi mod:
  149. .. code:: sh
  150. sudo apt-get install libapache2-mod-uwsgi
  151. sudo a2enmod uwsgi
  152. Add this configuration in the file /etc/apache2/apache2.conf:
  153. .. code:: apache
  154. <Location />
  155. Options FollowSymLinks Indexes
  156. SetHandler uwsgi-handler
  157. uWSGISocket /run/uwsgi/app/searx/socket
  158. </Location>
  159. Note that if your instance of searx is not at the root, you should
  160. change ``<Location />`` by the location of your instance, like
  161. ``<Location /searx>``.
  162. Restart Apache:
  163. .. code:: sh
  164. sudo /etc/init.d/apache2 restart
  165. disable logs
  166. """"""""""""
  167. For better privacy you can disable Apache logs.
  168. WARNING: not tested
  169. WARNING: you can only disable logs for the whole (virtual) server not
  170. for a specific path.
  171. Go back to /etc/apache2/apache2.conf and above ``<Location />`` add:
  172. .. code:: apache
  173. CustomLog /dev/null combined
  174. Restart Apache:
  175. .. code:: sh
  176. sudo /etc/init.d/apache2 restart
  177. How to update
  178. -------------
  179. .. code:: sh
  180. cd /usr/local/searx
  181. sudo -u searx -i
  182. . ./searx-ve/bin/activate
  183. git stash
  184. git pull origin master
  185. git stash apply
  186. ./manage.sh update_packages
  187. sudo service uwsgi restart
  188. Docker
  189. ------
  190. Make sure you have installed Docker. For instance, you can deploy searx like this:
  191. .. code:: sh
  192. docker pull wonderfall/searx
  193. docker run -d --name searx -p $PORT:8888 wonderfall/searx
  194. Go to http://localhost:$PORT.
  195. See https://hub.docker.com/r/wonderfall/searx/ for more informations.
  196. It's also possible to build searx from the embedded Dockerfile.
  197. .. code:: sh
  198. git clone https://github.com/asciimoo/searx.git
  199. cd searx
  200. docker build -t whatever/searx .
  201. References
  202. ==========
  203. * https://about.okhin.fr/posts/Searx/ with some additions
  204. * 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/>`__