2015-11-17 23:13:30 +01:00
|
|
|
Installation
|
|
|
|
============
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Step by step installation for Debian/Ubuntu with virtualenv.
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
Source: https://about.okhin.fr/posts/Searx/ with some additions
|
|
|
|
|
|
|
|
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/>`__
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
.. contents::
|
|
|
|
:depth: 3
|
|
|
|
|
2015-11-17 23:13:30 +01:00
|
|
|
Basic installation
|
|
|
|
------------------
|
|
|
|
|
|
|
|
For Ubuntu, be sure to have enable universe repository.
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Install packages:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev libffi-dev libssl-dev
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Install searx:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
cd /usr/local
|
|
|
|
sudo git clone https://github.com/asciimoo/searx.git
|
|
|
|
sudo useradd searx -d /usr/local/searx
|
|
|
|
sudo chown searx:searx -R /usr/local/searx
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Install dependencies in a virtualenv:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
sudo -u searx -i
|
|
|
|
cd /usr/local/searx
|
|
|
|
virtualenv searx-ve
|
|
|
|
. ./searx-ve/bin/activate
|
2016-01-10 20:10:53 +01:00
|
|
|
./manage.sh update_packages
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
Configuration
|
|
|
|
-------------
|
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml
|
|
|
|
|
|
|
|
Edit searx/settings.yml if necessary.
|
|
|
|
|
|
|
|
Check
|
|
|
|
-----
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Start searx:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
python searx/webapp.py
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
At this point searx is not demonized ; uwsgi allows this.
|
|
|
|
|
|
|
|
You can exit the virtualenv and the searx user bash (enter exit command
|
|
|
|
twice).
|
|
|
|
|
|
|
|
uwsgi
|
|
|
|
-----
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Install packages:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
sudo apt-get install uwsgi uwsgi-plugin-python
|
|
|
|
|
|
|
|
Create the configuration file /etc/uwsgi/apps-available/searx.ini with
|
2016-01-10 20:10:53 +01:00
|
|
|
this content:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
[uwsgi]
|
|
|
|
# Who will run the code
|
|
|
|
uid = searx
|
|
|
|
gid = searx
|
|
|
|
|
|
|
|
# disable logging for privacy
|
|
|
|
disable-logging = true
|
|
|
|
|
|
|
|
# Number of workers (usually CPU count)
|
|
|
|
workers = 4
|
|
|
|
|
|
|
|
# The right granted on the created socket
|
|
|
|
chmod-socket = 666
|
|
|
|
|
|
|
|
# Plugin to use and interpretor config
|
|
|
|
single-interpreter = true
|
|
|
|
master = true
|
|
|
|
plugin = python
|
|
|
|
|
|
|
|
# Module to import
|
|
|
|
module = searx.webapp
|
|
|
|
|
|
|
|
# Virtualenv and python path
|
|
|
|
virtualenv = /usr/local/searx/searx-ve/
|
|
|
|
pythonpath = /usr/local/searx/
|
|
|
|
chdir = /usr/local/searx/searx/
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Activate the uwsgi application and restart:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
cd /etc/uwsgi/apps-enabled
|
|
|
|
ln -s ../apps-available/searx.ini
|
|
|
|
/etc/init.d/uwsgi restart
|
|
|
|
|
|
|
|
Web server
|
|
|
|
----------
|
|
|
|
|
|
|
|
with nginx
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
If nginx is not installed (uwsgi will not work with the package
|
2016-01-10 20:10:53 +01:00
|
|
|
nginx-light):
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
sudo apt-get install nginx
|
|
|
|
|
|
|
|
Hosted at /
|
|
|
|
"""""""""""
|
|
|
|
|
|
|
|
Create the configuration file /etc/nginx/sites-available/searx with this
|
2016-01-10 20:10:53 +01:00
|
|
|
content:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: nginx
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
server_name searx.example.com;
|
|
|
|
root /usr/local/searx;
|
|
|
|
|
|
|
|
location / {
|
|
|
|
include uwsgi_params;
|
|
|
|
uwsgi_pass unix:/run/uwsgi/app/searx/socket;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Restart service:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
sudo service nginx restart
|
|
|
|
sudo service uwsgi restart
|
|
|
|
|
|
|
|
from subdirectory URL (/searx)
|
2016-01-10 20:10:53 +01:00
|
|
|
""""""""""""""""""""""""""""""
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
Add this configuration in the server config file
|
2016-01-10 20:10:53 +01:00
|
|
|
/etc/nginx/sites-available/default:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: nginx
|
|
|
|
|
|
|
|
location = /searx { rewrite ^ /searx/; }
|
|
|
|
location /searx {
|
|
|
|
try_files $uri @searx;
|
2016-04-21 13:16:18 +02:00
|
|
|
proxy_pass http://localhost:9999/;
|
|
|
|
proxy_set_header X-Script-Name /searx;
|
2015-11-17 23:13:30 +01:00
|
|
|
}
|
|
|
|
location @searx {
|
|
|
|
uwsgi_param SCRIPT_NAME /searx;
|
|
|
|
include uwsgi_params;
|
|
|
|
uwsgi_modifier1 30;
|
|
|
|
uwsgi_pass unix:/run/uwsgi/app/searx/socket;
|
|
|
|
}
|
|
|
|
|
2016-04-21 13:16:18 +02:00
|
|
|
|
2015-11-17 23:13:30 +01:00
|
|
|
Enable base\_url in searx/settings.yml
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
base_url : http://your.domain.tld/searx/
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Restart service:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
sudo service nginx restart
|
|
|
|
sudo service uwsgi restart
|
|
|
|
|
|
|
|
disable logs
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
|
|
for better privacy you can disable nginx logs about searx.
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
how to proceed: below ``uwsgi_pass`` in
|
2015-11-17 23:13:30 +01:00
|
|
|
/etc/nginx/sites-available/default add
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
access_log /dev/null;
|
|
|
|
error_log /dev/null;
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Restart service:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
sudo service nginx restart
|
|
|
|
|
|
|
|
with apache
|
2016-01-10 20:10:53 +01:00
|
|
|
^^^^^^^^^^^
|
2015-11-17 23:13:30 +01:00
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Add wsgi mod:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
sudo apt-get install libapache2-mod-uwsgi
|
|
|
|
sudo a2enmod uwsgi
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Add this configuration in the file /etc/apache2/apache2.conf:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: apache
|
|
|
|
|
|
|
|
<Location />
|
|
|
|
Options FollowSymLinks Indexes
|
|
|
|
SetHandler uwsgi-handler
|
|
|
|
uWSGISocket /run/uwsgi/app/searx/socket
|
|
|
|
</Location>
|
|
|
|
|
|
|
|
Note that if your instance of searx is not at the root, you should
|
|
|
|
change ``<Location />`` by the location of your instance, like
|
|
|
|
``<Location /searx>``.
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Restart Apache:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
sudo /etc/init.d/apache2 restart
|
|
|
|
|
|
|
|
disable logs
|
2016-01-10 20:10:53 +01:00
|
|
|
""""""""""""
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
For better privacy you can disable Apache logs.
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
WARNING: not tested
|
2015-11-17 23:13:30 +01:00
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
WARNING: you can only disable logs for the whole (virtual) server not
|
2015-11-17 23:13:30 +01:00
|
|
|
for a specific path.
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Go back to /etc/apache2/apache2.conf and above ``<Location />`` add:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: apache
|
|
|
|
|
|
|
|
CustomLog /dev/null combined
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Restart Apache:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
sudo /etc/init.d/apache2 restart
|
|
|
|
|
|
|
|
How to update
|
|
|
|
-------------
|
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
cd /usr/local/searx
|
|
|
|
sudo -u searx -i
|
|
|
|
. ./searx-ve/bin/activate
|
|
|
|
git stash
|
|
|
|
git pull origin master
|
|
|
|
git stash apply
|
2016-01-10 20:10:53 +01:00
|
|
|
./manage.sh update_packages
|
2015-11-17 23:13:30 +01:00
|
|
|
sudo service uwsgi restart
|
|
|
|
|
2016-01-10 20:10:53 +01:00
|
|
|
Docker
|
|
|
|
------
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
Go to http://localhost:$PORT.
|
|
|
|
|
|
|
|
See https://hub.docker.com/r/wonderfall/searx/ for more informations.
|
|
|
|
|
|
|
|
It's also possible to build searx from the embedded Dockerfile.
|
|
|
|
|
|
|
|
.. code:: sh
|
|
|
|
|
|
|
|
git clone https://github.com/asciimoo/searx.git
|
|
|
|
cd searx
|
|
|
|
docker build -t whatever/searx .
|