searx/admin/installation.html

402 lines
22 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Installation &#8212; Searx Documentation (Searx-0.15.0.tex)</title>
<link rel="stylesheet" href="../_static/searx.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="settings.yml" href="settings.html" />
<link rel="prev" title="Administrator documentation" href="index.html" />
<script>DOCUMENTATION_OPTIONS.URL_ROOT = '../';</script>
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="settings.html" title="settings.yml"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="index.html" title="Administrator documentation"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Searx Documentation (Searx-0.15.0.tex)</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Administrator documentation</a> &#187;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="installation">
<span id="id1"></span><h1><a class="toc-backref" href="#id3">Installation</a><a class="headerlink" href="#installation" title="Permalink to this headline"></a></h1>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#installation" id="id3">Installation</a></p>
<ul>
<li><p><a class="reference internal" href="#basic-installation" id="id4">Basic installation</a></p></li>
<li><p><a class="reference internal" href="#configuration" id="id5">Configuration</a></p></li>
<li><p><a class="reference internal" href="#check" id="id6">Check</a></p></li>
<li><p><a class="reference internal" href="#uwsgi" id="id7">uwsgi</a></p></li>
<li><p><a class="reference internal" href="#web-server" id="id8">Web server</a></p>
<ul>
<li><p><a class="reference internal" href="#with-nginx" id="id9">with nginx</a></p></li>
<li><p><a class="reference internal" href="#with-apache" id="id10">with apache</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#how-to-update" id="id11">How to update</a></p></li>
<li><p><a class="reference internal" href="#docker" id="id12">Docker</a></p></li>
<li><p><a class="reference internal" href="#references" id="id13">References</a></p></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="basic-installation">
<h2><a class="toc-backref" href="#id4">Basic installation</a><a class="headerlink" href="#basic-installation" title="Permalink to this headline"></a></h2>
<p>Step by step installation for Debian/Ubuntu with virtualenv. For Ubuntu, be sure
to have enable universe repository.</p>
<p>Install packages:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H apt-get install <span class="se">\</span>
git build-essential libxslt-dev <span class="se">\</span>
python-dev python-virtualenv python-babel <span class="se">\</span>
zlib1g-dev libffi-dev libssl-dev
</pre></div>
</div>
<p>Install searx:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> /usr/local
sudo -H git clone https://github.com/asciimoo/searx.git
sudo -H useradd searx -d /usr/local/searx
sudo -H chown searx:searx -R /usr/local/searx
</pre></div>
</div>
<p>Install dependencies in a virtualenv:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> /usr/local/searx
sudo -H -u searx -i
</pre></div>
</div>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="o">(</span>searx<span class="o">)</span>$ virtualenv searx-ve
<span class="o">(</span>searx<span class="o">)</span>$ . ./searx-ve/bin/activate
<span class="o">(</span>searx<span class="o">)</span>$ ./manage.sh update_packages
</pre></div>
</div>
</div>
<div class="section" id="configuration">
<h2><a class="toc-backref" href="#id5">Configuration</a><a class="headerlink" href="#configuration" title="Permalink to this headline"></a></h2>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sed -i -e <span class="s2">&quot;s/ultrasecretkey/`openssl rand -hex 16`/g&quot;</span> searx/settings.yml
</pre></div>
</div>
<p>Edit searx/settings.yml if necessary.</p>
</div>
<div class="section" id="check">
<h2><a class="toc-backref" href="#id6">Check</a><a class="headerlink" href="#check" title="Permalink to this headline"></a></h2>
<p>Start searx:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>python searx/webapp.py
</pre></div>
</div>
<p>Go to <a class="reference external" href="http://localhost:8888">http://localhost:8888</a></p>
<p>If everything works fine, disable the debug option in settings.yml:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sed -i -e <span class="s2">&quot;s/debug : True/debug : False/g&quot;</span> searx/settings.yml
</pre></div>
</div>
<p>At this point searx is not demonized ; uwsgi allows this.</p>
<p>You can exit the virtualenv and the searx user bash (enter exit command
twice).</p>
</div>
<div class="section" id="uwsgi">
<h2><a class="toc-backref" href="#id7">uwsgi</a><a class="headerlink" href="#uwsgi" title="Permalink to this headline"></a></h2>
<p>Install packages:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H apt-get install <span class="se">\</span>
uwsgi uwsgi-plugin-python
</pre></div>
</div>
<p>Create the configuration file <code class="docutils literal notranslate"><span class="pre">/etc/uwsgi/apps-available/searx.ini</span></code> with this
content:</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[uwsgi]</span>
<span class="c1"># Who will run the code</span>
<span class="na">uid</span> <span class="o">=</span> <span class="s">searx</span>
<span class="na">gid</span> <span class="o">=</span> <span class="s">searx</span>
<span class="c1"># disable logging for privacy</span>
<span class="na">disable-logging</span> <span class="o">=</span> <span class="s">true</span>
<span class="c1"># Number of workers (usually CPU count)</span>
<span class="na">workers</span> <span class="o">=</span> <span class="s">4</span>
<span class="c1"># The right granted on the created socket</span>
<span class="na">chmod-socket</span> <span class="o">=</span> <span class="s">666</span>
<span class="c1"># Plugin to use and interpretor config</span>
<span class="na">single-interpreter</span> <span class="o">=</span> <span class="s">true</span>
<span class="na">master</span> <span class="o">=</span> <span class="s">true</span>
<span class="na">plugin</span> <span class="o">=</span> <span class="s">python</span>
<span class="na">lazy-apps</span> <span class="o">=</span> <span class="s">true</span>
<span class="na">enable-threads</span> <span class="o">=</span> <span class="s">true</span>
<span class="c1"># Module to import</span>
<span class="na">module</span> <span class="o">=</span> <span class="s">searx.webapp</span>
<span class="c1"># Support running the module from a webserver subdirectory.</span>
<span class="na">route-run</span> <span class="o">=</span> <span class="s">fixpathinfo:</span>
<span class="c1"># Virtualenv and python path</span>
<span class="na">virtualenv</span> <span class="o">=</span> <span class="s">/usr/local/searx/searx-ve/</span>
<span class="na">pythonpath</span> <span class="o">=</span> <span class="s">/usr/local/searx/</span>
<span class="na">chdir</span> <span class="o">=</span> <span class="s">/usr/local/searx/searx/</span>
</pre></div>
</div>
<p>Activate the uwsgi application and restart:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> /etc/uwsgi/apps-enabled
ln -s ../apps-available/searx.ini
/etc/init.d/uwsgi restart
</pre></div>
</div>
</div>
<div class="section" id="web-server">
<h2><a class="toc-backref" href="#id8">Web server</a><a class="headerlink" href="#web-server" title="Permalink to this headline"></a></h2>
<div class="section" id="with-nginx">
<h3><a class="toc-backref" href="#id9">with nginx</a><a class="headerlink" href="#with-nginx" title="Permalink to this headline"></a></h3>
<p>If nginx is not installed (uwsgi will not work with the package
nginx-light):</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H apt-get install nginx
</pre></div>
</div>
<div class="section" id="hosted-at">
<h4>Hosted at /<a class="headerlink" href="#hosted-at" title="Permalink to this headline"></a></h4>
<p>Create the configuration file <code class="docutils literal notranslate"><span class="pre">/etc/nginx/sites-available/searx</span></code> with this
content:</p>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">server</span> <span class="p">{</span>
<span class="kn">listen</span> <span class="mi">80</span><span class="p">;</span>
<span class="kn">server_name</span> <span class="s">searx.example.com</span><span class="p">;</span>
<span class="kn">root</span> <span class="s">/usr/local/searx/searx</span><span class="p">;</span>
<span class="kn">location</span> <span class="s">/static</span> <span class="p">{</span>
<span class="p">}</span>
<span class="kn">location</span> <span class="s">/</span> <span class="p">{</span>
<span class="kn">include</span> <span class="s">uwsgi_params</span><span class="p">;</span>
<span class="kn">uwsgi_pass</span> <span class="s">unix:/run/uwsgi/app/searx/socket</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Create a symlink to sites-enabled:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx
</pre></div>
</div>
<p>Restart service:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H service nginx restart
sudo -H service uwsgi restart
</pre></div>
</div>
</div>
<div class="section" id="from-subdirectory-url-searx">
<h4>from subdirectory URL (/searx)<a class="headerlink" href="#from-subdirectory-url-searx" title="Permalink to this headline"></a></h4>
<p>Add this configuration in the server config file
<code class="docutils literal notranslate"><span class="pre">/etc/nginx/sites-enabled/default</span></code>:</p>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">location</span> <span class="s">/searx/static</span> <span class="p">{</span>
<span class="kn">alias</span> <span class="s">/usr/local/searx/searx/static</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">location</span> <span class="s">/searx</span> <span class="p">{</span>
<span class="kn">uwsgi_param</span> <span class="s">SCRIPT_NAME</span> <span class="s">/searx</span><span class="p">;</span>
<span class="kn">include</span> <span class="s">uwsgi_params</span><span class="p">;</span>
<span class="kn">uwsgi_pass</span> <span class="s">unix:/run/uwsgi/app/searx/socket</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
<p><strong>OR</strong> using reverse proxy (Please, note that reverse proxy advised to be used
in case of single-user or low-traffic instances.)</p>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">location</span> <span class="s">/searx/static</span> <span class="p">{</span>
<span class="kn">alias</span> <span class="s">/usr/local/searx/searx/static</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">location</span> <span class="s">/searx</span> <span class="p">{</span>
<span class="kn">proxy_pass</span> <span class="s">http://127.0.0.1:8888</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">Host</span> <span class="nv">$host</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Forwarded-For</span> <span class="nv">$proxy_add_x_forwarded_for</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Scheme</span> <span class="nv">$scheme</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Script-Name</span> <span class="s">/searx</span><span class="p">;</span>
<span class="kn">proxy_buffering</span> <span class="no">off</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Enable <code class="docutils literal notranslate"><span class="pre">base_url</span></code> in <code class="docutils literal notranslate"><span class="pre">searx/settings.yml</span></code></p>
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">base_url</span> <span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">http://your.domain.tld/searx/</span>
</pre></div>
</div>
<p>Restart service:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H service nginx restart
sudo -H service uwsgi restart
</pre></div>
</div>
<div class="section" id="disable-logs">
<h5>disable logs<a class="headerlink" href="#disable-logs" title="Permalink to this headline"></a></h5>
<p>for better privacy you can disable nginx logs about searx.</p>
<p>how to proceed: below <code class="docutils literal notranslate"><span class="pre">uwsgi_pass</span></code> in <code class="docutils literal notranslate"><span class="pre">/etc/nginx/sites-available/default</span></code>
add:</p>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">access_log</span> <span class="s">/dev/null</span><span class="p">;</span>
<span class="k">error_log</span> <span class="s">/dev/null</span><span class="p">;</span>
</pre></div>
</div>
<p>Restart service:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H service nginx restart
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="with-apache">
<h3><a class="toc-backref" href="#id10">with apache</a><a class="headerlink" href="#with-apache" title="Permalink to this headline"></a></h3>
<p>Add wsgi mod:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H apt-get install libapache2-mod-uwsgi
sudo -H a2enmod uwsgi
</pre></div>
</div>
<p>Add this configuration in the file <code class="docutils literal notranslate"><span class="pre">/etc/apache2/apache2.conf</span></code>:</p>
<div class="highlight-apache notranslate"><div class="highlight"><pre><span></span><span class="nt">&lt;Location</span> <span class="s">/</span><span class="nt">&gt;</span>
<span class="nb">Options</span> FollowSymLinks Indexes
<span class="nb">SetHandler</span> uwsgi-handler
<span class="nb">uWSGISocket</span> <span class="sx">/run/uwsgi/app/searx/socket</span>
<span class="nt">&lt;/Location&gt;</span>
</pre></div>
</div>
<p>Note that if your instance of searx is not at the root, you should change
<code class="docutils literal notranslate"><span class="pre">&lt;Location</span> <span class="pre">/&gt;</span></code> by the location of your instance, like <code class="docutils literal notranslate"><span class="pre">&lt;Location</span> <span class="pre">/searx&gt;</span></code>.</p>
<p>Restart Apache:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H /etc/init.d/apache2 restart
</pre></div>
</div>
<div class="section" id="id2">
<h4>disable logs<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h4>
<p>For better privacy you can disable Apache logs.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>You can only disable logs for the whole (virtual) server not for a specific
path.</p>
</div>
<p>Go back to <code class="docutils literal notranslate"><span class="pre">/etc/apache2/apache2.conf</span></code> and above <code class="docutils literal notranslate"><span class="pre">&lt;Location</span> <span class="pre">/&gt;</span></code> add:</p>
<div class="highlight-apache notranslate"><div class="highlight"><pre><span></span><span class="nb">CustomLog</span> <span class="sx">/dev/null</span> combined
</pre></div>
</div>
<p>Restart Apache:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H /etc/init.d/apache2 restart
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="how-to-update">
<h2><a class="toc-backref" href="#id11">How to update</a><a class="headerlink" href="#how-to-update" title="Permalink to this headline"></a></h2>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> /usr/local/searx
sudo -H -u searx -i
</pre></div>
</div>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="o">(</span>searx<span class="o">)</span>$ . ./searx-ve/bin/activate
<span class="o">(</span>searx<span class="o">)</span>$ git stash
<span class="o">(</span>searx<span class="o">)</span>$ git pull origin master
<span class="o">(</span>searx<span class="o">)</span>$ git stash apply
<span class="o">(</span>searx<span class="o">)</span>$ ./manage.sh update_packages
</pre></div>
</div>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H service uwsgi restart
</pre></div>
</div>
</div>
<div class="section" id="docker">
<h2><a class="toc-backref" href="#id12">Docker</a><a class="headerlink" href="#docker" title="Permalink to this headline"></a></h2>
<p>Make sure you have installed Docker. For instance, you can deploy searx like this:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>docker pull wonderfall/searx
docker run -d --name searx -p <span class="nv">$PORT</span>:8888 wonderfall/searx
</pre></div>
</div>
<p>Go to <code class="docutils literal notranslate"><span class="pre">http://localhost:$PORT</span></code>.</p>
<p>See <a class="reference external" href="https://hub.docker.com/r/wonderfall/searx/">https://hub.docker.com/r/wonderfall/searx/</a> for more informations. Its also
possible to build searx from the embedded Dockerfile.</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>git clone https://github.com/asciimoo/searx.git
<span class="nb">cd</span> searx
docker build -t whatever/searx .
</pre></div>
</div>
</div>
<div class="section" id="references">
<h2><a class="toc-backref" href="#id13">References</a><a class="headerlink" href="#references" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li><p><a class="reference external" href="https://about.okhin.fr/posts/Searx/">https://about.okhin.fr/posts/Searx/</a> with some additions</p></li>
<li><p>How to: <a class="reference external" href="https://www.reddit.com/r/privacytoolsIO/comments/366kvn/how_to_setup_your_own_privacy_respecting_search/">Setup searx in a couple of hours with a free SSL certificate</a></p></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<span id="sidebar-top"></span>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/searx_logo_small.png" alt="Logo"/>
</a></p>
<h3>Project Links</h3>
<ul>
<li><a href="https://github.com/asciimoo/searx">Source</a>
<li><a href="https://github.com/asciimoo/searx/wiki">Wiki</a>
<li><a href="https://asciimoo.github.io/searx/user/public_instances.html">Public instances</a>
<li><a href="https://twitter.com/Searx_engine">Twitter</a>
</ul><h3>Navigation</h3>
<ul>
<li><a href="../index.html">Overview</a>
<ul>
<li><a href="index.html">Administrator documentation</a>
<ul>
<li>Previous: <a href="index.html" title="previous chapter">Administrator documentation</a>
<li>Next: <a href="settings.html" title="next chapter"><code class="docutils literal notranslate"><span class="pre">settings.yml</span></code></a></ul>
</li>
</ul>
</li>
</ul>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2015-2019, Adam Tauber, Noémi Ványi.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.3.1.
</div>
<script type="text/javascript" src="../_static/version_warning_offset.js"></script>
</body>
</html>