on 3bb97fc help sign in
searx/docs/admin/installation.rst
349 lines 6.9 kB history raw
1.. _installation:
3============
4Installation
5============
7.. contents::
8 :depth: 3
10Basic installation
11==================
13Step by step installation for Debian/Ubuntu with virtualenv. For Ubuntu, be sure
14to have enable universe repository.
16Install packages:
18.. code:: sh
20 $ sudo -H apt-get install \
21 git build-essential libxslt-dev \
22 python-dev python-virtualenv python-babel \
23 zlib1g-dev libffi-dev libssl-dev
25Install searx:
27.. code:: sh
29 cd /usr/local
30 sudo -H git clone https://github.com/asciimoo/searx.git
31 sudo -H useradd searx -d /usr/local/searx
32 sudo -H chown searx:searx -R /usr/local/searx
34Install dependencies in a virtualenv:
36.. code:: sh
38 cd /usr/local/searx
39 sudo -H -u searx -i
41.. code:: sh
43 (searx)$ virtualenv searx-ve
44 (searx)$ . ./searx-ve/bin/activate
45 (searx)$ ./manage.sh update_packages
47Configuration
48==============
50.. code:: sh
52 sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml
54Edit searx/settings.yml if necessary.
56Check
57=====
59Start searx:
61.. code:: sh
63 python searx/webapp.py
65Go to http://localhost:8888
67If everything works fine, disable the debug option in settings.yml:
69.. code:: sh
71 sed -i -e "s/debug : True/debug : False/g" searx/settings.yml
73At this point searx is not demonized ; uwsgi allows this.
75You can exit the virtualenv and the searx user bash (enter exit command
76twice).
78uwsgi
79=====
81Install packages:
83.. code:: sh
85 sudo -H apt-get install \
86 uwsgi uwsgi-plugin-python
88Create the configuration file ``/etc/uwsgi/apps-available/searx.ini`` with this
89content:
91.. code:: ini
93 [uwsgi]
94 # Who will run the code
95 uid = searx
96 gid = searx
98 # disable logging for privacy
99 disable-logging = true
101 # Number of workers (usually CPU count)
102 workers = 4
104 # The right granted on the created socket
105 chmod-socket = 666
107 # Plugin to use and interpretor config
108 single-interpreter = true
109 master = true
110 plugin = python
111 lazy-apps = true
112 enable-threads = true
114 # Module to import
115 module = searx.webapp
117 # Support running the module from a webserver subdirectory.
118 route-run = fixpathinfo:
120 # Virtualenv and python path
121 virtualenv = /usr/local/searx/searx-ve/
122 pythonpath = /usr/local/searx/
123 chdir = /usr/local/searx/searx/
125Activate the uwsgi application and restart:
127.. code:: sh
129 cd /etc/uwsgi/apps-enabled
130 ln -s ../apps-available/searx.ini
131 /etc/init.d/uwsgi restart
133Web server
134==========
136with nginx
137----------
139If nginx is not installed (uwsgi will not work with the package
140nginx-light):
142.. code:: sh
144 sudo -H apt-get install nginx
146Hosted at /
147~~~~~~~~~~~
149Create the configuration file ``/etc/nginx/sites-available/searx`` with this
150content:
152.. code:: nginx
154 server {
155 listen 80;
156 server_name searx.example.com;
157 root /usr/local/searx/searx;
159 location /static {
160 }
162 location / {
163 include uwsgi_params;
164 uwsgi_pass unix:/run/uwsgi/app/searx/socket;
165 }
166 }
168Create a symlink to sites-enabled:
170.. code:: sh
172 sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx
174Restart service:
176.. code:: sh
178 sudo -H service nginx restart
179 sudo -H service uwsgi restart
181from subdirectory URL (/searx)
182~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184Add this configuration in the server config file
185``/etc/nginx/sites-enabled/default``:
187.. code:: nginx
189 location /searx/static {
190 alias /usr/local/searx/searx/static;
191 }
193 location /searx {
194 uwsgi_param SCRIPT_NAME /searx;
195 include uwsgi_params;
196 uwsgi_pass unix:/run/uwsgi/app/searx/socket;
197 }
200**OR** using reverse proxy (Please, note that reverse proxy advised to be used
201in case of single-user or low-traffic instances.)
203.. code:: nginx
205 location /searx/static {
206 alias /usr/local/searx/searx/static;
207 }
209 location /searx {
210 proxy_pass http://127.0.0.1:8888;
211 proxy_set_header Host $host;
212 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
213 proxy_set_header X-Scheme $scheme;
214 proxy_set_header X-Script-Name /searx;
215 proxy_buffering off;
216 }
219Enable ``base_url`` in ``searx/settings.yml``
221.. code:: yaml
223 base_url : http://your.domain.tld/searx/
225Restart service:
227.. code:: sh
229 sudo -H service nginx restart
230 sudo -H service uwsgi restart
232disable logs
233^^^^^^^^^^^^
235for better privacy you can disable nginx logs about searx.
237how to proceed: below ``uwsgi_pass`` in ``/etc/nginx/sites-available/default``
238add:
240.. code:: nginx
242 access_log /dev/null;
243 error_log /dev/null;
245Restart service:
247.. code:: sh
249 sudo -H service nginx restart
251with apache
252-----------
254Add wsgi mod:
256.. code:: sh
258 sudo -H apt-get install libapache2-mod-uwsgi
259 sudo -H a2enmod uwsgi
261Add this configuration in the file ``/etc/apache2/apache2.conf``:
263.. code:: apache
265 <Location />
266 Options FollowSymLinks Indexes
267 SetHandler uwsgi-handler
268 uWSGISocket /run/uwsgi/app/searx/socket
269 </Location>
271Note that if your instance of searx is not at the root, you should change
272``<Location />`` by the location of your instance, like ``<Location /searx>``.
274Restart Apache:
276.. code:: sh
278 sudo -H /etc/init.d/apache2 restart
280disable logs
281~~~~~~~~~~~~
283For better privacy you can disable Apache logs.
285.. warning::
287 You can only disable logs for the whole (virtual) server not for a specific
288 path.
290Go back to ``/etc/apache2/apache2.conf`` and above ``<Location />`` add:
292.. code:: apache
294 CustomLog /dev/null combined
296Restart Apache:
298.. code:: sh
300 sudo -H /etc/init.d/apache2 restart
302How to update
303=============
305.. code:: sh
307 cd /usr/local/searx
308 sudo -H -u searx -i
310.. code:: sh
312 (searx)$ . ./searx-ve/bin/activate
313 (searx)$ git stash
314 (searx)$ git pull origin master
315 (searx)$ git stash apply
316 (searx)$ ./manage.sh update_packages
318.. code:: sh
320 sudo -H service uwsgi restart
322Docker
323======
325Make sure you have installed Docker. For instance, you can deploy searx like this:
327.. code:: sh
329 docker pull wonderfall/searx
330 docker run -d --name searx -p $PORT:8888 wonderfall/searx
332Go to ``http://localhost:$PORT``.
334See https://hub.docker.com/r/wonderfall/searx/ for more informations. It's also
335possible to build searx from the embedded Dockerfile.
337.. code:: sh
339 git clone https://github.com/asciimoo/searx.git
340 cd searx
341 docker build -t whatever/searx .
343References
344==========
346* https://about.okhin.fr/posts/Searx/ with some additions
348* How to: `Setup searx in a couple of hours with a free SSL certificate
349 <https://www.reddit.com/r/privacytoolsIO/comments/366kvn/how_to_setup_your_own_privacy_respecting_search/>`__