installation.html 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Installation &mdash; searx 0.8.0 documentation</title>
  7. <link rel="stylesheet" href="../../_static/style.css" type="text/css" />
  8. <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: '../../',
  12. VERSION: '0.8.0',
  13. COLLAPSE_INDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true
  16. };
  17. </script>
  18. <script type="text/javascript" src="../../_static/jquery.js"></script>
  19. <script type="text/javascript" src="../../_static/underscore.js"></script>
  20. <script type="text/javascript" src="../../_static/doctools.js"></script>
  21. <link rel="top" title="searx 0.8.0 documentation" href="../../index.html" />
  22. <link rel="next" title="Engine overview" href="../engine_overview.html" />
  23. <link rel="prev" title="How to contribute" href="../contribution_guide.html" />
  24. <link media="only screen and (max-device-width: 480px)" href="../../_static/small_flask.css" type= "text/css" rel="stylesheet" />
  25. <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
  26. </head>
  27. <body role="document">
  28. <div class="document">
  29. <div class="documentwrapper">
  30. <div class="bodywrapper">
  31. <div class="body" role="main">
  32. <div class="section" id="installation">
  33. <h1><a class="toc-backref" href="#id2">Installation</a><a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h1>
  34. <p>Step by step installation for Debian/Ubuntu with virtualenv.</p>
  35. <p>Source: <a class="reference external" href="https://about.okhin.fr/posts/Searx/">https://about.okhin.fr/posts/Searx/</a> with some additions</p>
  36. <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
  37. certificate</a></p>
  38. <div class="contents topic" id="contents">
  39. <p class="topic-title first">Contents</p>
  40. <ul class="simple">
  41. <li><a class="reference internal" href="#installation" id="id2">Installation</a><ul>
  42. <li><a class="reference internal" href="#basic-installation" id="id3">Basic installation</a></li>
  43. <li><a class="reference internal" href="#configuration" id="id4">Configuration</a></li>
  44. <li><a class="reference internal" href="#check" id="id5">Check</a></li>
  45. <li><a class="reference internal" href="#uwsgi" id="id6">uwsgi</a></li>
  46. <li><a class="reference internal" href="#web-server" id="id7">Web server</a><ul>
  47. <li><a class="reference internal" href="#with-nginx" id="id8">with nginx</a></li>
  48. <li><a class="reference internal" href="#with-apache" id="id9">with apache</a></li>
  49. </ul>
  50. </li>
  51. <li><a class="reference internal" href="#how-to-update" id="id10">How to update</a></li>
  52. <li><a class="reference internal" href="#docker" id="id11">Docker</a></li>
  53. </ul>
  54. </li>
  55. </ul>
  56. </div>
  57. <div class="section" id="basic-installation">
  58. <h2><a class="toc-backref" href="#id3">Basic installation</a><a class="headerlink" href="#basic-installation" title="Permalink to this headline">¶</a></h2>
  59. <p>For Ubuntu, be sure to have enable universe repository.</p>
  60. <p>Install packages:</p>
  61. <div class="code sh highlight-python"><div class="highlight"><pre>sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev libffi-dev libssl-dev
  62. </pre></div>
  63. </div>
  64. <p>Install searx:</p>
  65. <div class="code sh highlight-python"><div class="highlight"><pre>cd /usr/local
  66. sudo git clone https://github.com/asciimoo/searx.git
  67. sudo useradd searx -d /usr/local/searx
  68. sudo chown searx:searx -R /usr/local/searx
  69. </pre></div>
  70. </div>
  71. <p>Install dependencies in a virtualenv:</p>
  72. <div class="code sh highlight-python"><div class="highlight"><pre>sudo -u searx -i
  73. cd /usr/local/searx
  74. virtualenv searx-ve
  75. . ./searx-ve/bin/activate
  76. ./manage.sh update_packages
  77. </pre></div>
  78. </div>
  79. </div>
  80. <div class="section" id="configuration">
  81. <h2><a class="toc-backref" href="#id4">Configuration</a><a class="headerlink" href="#configuration" title="Permalink to this headline">¶</a></h2>
  82. <div class="code sh highlight-python"><div class="highlight"><pre>sed -i -e &quot;s/ultrasecretkey/`openssl rand -hex 16`/g&quot; searx/settings.yml
  83. </pre></div>
  84. </div>
  85. <p>Edit searx/settings.yml if necessary.</p>
  86. </div>
  87. <div class="section" id="check">
  88. <h2><a class="toc-backref" href="#id5">Check</a><a class="headerlink" href="#check" title="Permalink to this headline">¶</a></h2>
  89. <p>Start searx:</p>
  90. <div class="code sh highlight-python"><div class="highlight"><pre>python searx/webapp.py
  91. </pre></div>
  92. </div>
  93. <p>Go to <a class="reference external" href="http://localhost:8888">http://localhost:8888</a></p>
  94. <p>If everything works fine, disable the debug option in settings.yml:</p>
  95. <div class="code sh highlight-python"><div class="highlight"><pre>sed -i -e &quot;s/debug : True/debug : False/g&quot; searx/settings.yml
  96. </pre></div>
  97. </div>
  98. <p>At this point searx is not demonized ; uwsgi allows this.</p>
  99. <p>You can exit the virtualenv and the searx user bash (enter exit command
  100. twice).</p>
  101. </div>
  102. <div class="section" id="uwsgi">
  103. <h2><a class="toc-backref" href="#id6">uwsgi</a><a class="headerlink" href="#uwsgi" title="Permalink to this headline">¶</a></h2>
  104. <p>Install packages:</p>
  105. <div class="code sh highlight-python"><div class="highlight"><pre>sudo apt-get install uwsgi uwsgi-plugin-python
  106. </pre></div>
  107. </div>
  108. <p>Create the configuration file /etc/uwsgi/apps-available/searx.ini with
  109. this content:</p>
  110. <div class="highlight-python"><div class="highlight"><pre>[uwsgi]
  111. # Who will run the code
  112. uid = searx
  113. gid = searx
  114. # disable logging for privacy
  115. disable-logging = true
  116. # Number of workers (usually CPU count)
  117. workers = 4
  118. # The right granted on the created socket
  119. chmod-socket = 666
  120. # Plugin to use and interpretor config
  121. single-interpreter = true
  122. master = true
  123. plugin = python
  124. # Module to import
  125. module = searx.webapp
  126. # Virtualenv and python path
  127. virtualenv = /usr/local/searx/searx-ve/
  128. pythonpath = /usr/local/searx/
  129. chdir = /usr/local/searx/searx/
  130. </pre></div>
  131. </div>
  132. <p>Activate the uwsgi application and restart:</p>
  133. <div class="code sh highlight-python"><div class="highlight"><pre>cd /etc/uwsgi/apps-enabled
  134. ln -s ../apps-available/searx.ini
  135. /etc/init.d/uwsgi restart
  136. </pre></div>
  137. </div>
  138. </div>
  139. <div class="section" id="web-server">
  140. <h2><a class="toc-backref" href="#id7">Web server</a><a class="headerlink" href="#web-server" title="Permalink to this headline">¶</a></h2>
  141. <div class="section" id="with-nginx">
  142. <h3><a class="toc-backref" href="#id8">with nginx</a><a class="headerlink" href="#with-nginx" title="Permalink to this headline">¶</a></h3>
  143. <p>If nginx is not installed (uwsgi will not work with the package
  144. nginx-light):</p>
  145. <div class="code sh highlight-python"><div class="highlight"><pre>sudo apt-get install nginx
  146. </pre></div>
  147. </div>
  148. <div class="section" id="hosted-at">
  149. <h4>Hosted at /<a class="headerlink" href="#hosted-at" title="Permalink to this headline">¶</a></h4>
  150. <p>Create the configuration file /etc/nginx/sites-available/searx with this
  151. content:</p>
  152. <div class="code nginx highlight-python"><div class="highlight"><pre>server {
  153. listen 80;
  154. server_name searx.example.com;
  155. root /usr/local/searx;
  156. location / {
  157. include uwsgi_params;
  158. uwsgi_pass unix:/run/uwsgi/app/searx/socket;
  159. }
  160. }
  161. </pre></div>
  162. </div>
  163. <p>Restart service:</p>
  164. <div class="code sh highlight-python"><div class="highlight"><pre>sudo service nginx restart
  165. sudo service uwsgi restart
  166. </pre></div>
  167. </div>
  168. </div>
  169. <div class="section" id="from-subdirectory-url-searx">
  170. <h4>from subdirectory URL (/searx)<a class="headerlink" href="#from-subdirectory-url-searx" title="Permalink to this headline">¶</a></h4>
  171. <p>Add this configuration in the server config file
  172. /etc/nginx/sites-available/default:</p>
  173. <div class="code nginx highlight-python"><div class="highlight"><pre>location = /searx { rewrite ^ /searx/; }
  174. location /searx {
  175. try_files $uri @searx;
  176. }
  177. location @searx {
  178. uwsgi_param SCRIPT_NAME /searx;
  179. include uwsgi_params;
  180. uwsgi_modifier1 30;
  181. uwsgi_pass unix:/run/uwsgi/app/searx/socket;
  182. }
  183. </pre></div>
  184. </div>
  185. <p>Enable base_url in searx/settings.yml</p>
  186. <div class="highlight-python"><div class="highlight"><pre>base_url : http://your.domain.tld/searx/
  187. </pre></div>
  188. </div>
  189. <p>Restart service:</p>
  190. <div class="code sh highlight-python"><div class="highlight"><pre>sudo service nginx restart
  191. sudo service uwsgi restart
  192. </pre></div>
  193. </div>
  194. <div class="section" id="disable-logs">
  195. <h5>disable logs<a class="headerlink" href="#disable-logs" title="Permalink to this headline">¶</a></h5>
  196. <p>for better privacy you can disable nginx logs about searx.</p>
  197. <p>how to proceed: below <code class="docutils literal"><span class="pre">uwsgi_pass</span></code> in
  198. /etc/nginx/sites-available/default add</p>
  199. <div class="highlight-python"><div class="highlight"><pre><span class="n">access_log</span> <span class="o">/</span><span class="n">dev</span><span class="o">/</span><span class="n">null</span><span class="p">;</span>
  200. <span class="n">error_log</span> <span class="o">/</span><span class="n">dev</span><span class="o">/</span><span class="n">null</span><span class="p">;</span>
  201. </pre></div>
  202. </div>
  203. <p>Restart service:</p>
  204. <div class="code sh highlight-python"><div class="highlight"><pre>sudo service nginx restart
  205. </pre></div>
  206. </div>
  207. </div>
  208. </div>
  209. </div>
  210. <div class="section" id="with-apache">
  211. <h3><a class="toc-backref" href="#id9">with apache</a><a class="headerlink" href="#with-apache" title="Permalink to this headline">¶</a></h3>
  212. <p>Add wsgi mod:</p>
  213. <div class="code sh highlight-python"><div class="highlight"><pre>sudo apt-get install libapache2-mod-uwsgi
  214. sudo a2enmod uwsgi
  215. </pre></div>
  216. </div>
  217. <p>Add this configuration in the file /etc/apache2/apache2.conf:</p>
  218. <div class="code apache highlight-python"><div class="highlight"><pre>&lt;Location /&gt;
  219. Options FollowSymLinks Indexes
  220. SetHandler uwsgi-handler
  221. uWSGISocket /run/uwsgi/app/searx/socket
  222. &lt;/Location&gt;
  223. </pre></div>
  224. </div>
  225. <p>Note that if your instance of searx is not at the root, you should
  226. change <code class="docutils literal"><span class="pre">&lt;Location</span> <span class="pre">/&gt;</span></code> by the location of your instance, like
  227. <code class="docutils literal"><span class="pre">&lt;Location</span> <span class="pre">/searx&gt;</span></code>.</p>
  228. <p>Restart Apache:</p>
  229. <div class="code sh highlight-python"><div class="highlight"><pre>sudo /etc/init.d/apache2 restart
  230. </pre></div>
  231. </div>
  232. <div class="section" id="id1">
  233. <h4>disable logs<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h4>
  234. <p>For better privacy you can disable Apache logs.</p>
  235. <p>WARNING: not tested</p>
  236. <p>WARNING: you can only disable logs for the whole (virtual) server not
  237. for a specific path.</p>
  238. <p>Go back to /etc/apache2/apache2.conf and above <code class="docutils literal"><span class="pre">&lt;Location</span> <span class="pre">/&gt;</span></code> add:</p>
  239. <div class="code apache highlight-python"><div class="highlight"><pre>CustomLog /dev/null combined
  240. </pre></div>
  241. </div>
  242. <p>Restart Apache:</p>
  243. <div class="code sh highlight-python"><div class="highlight"><pre>sudo /etc/init.d/apache2 restart
  244. </pre></div>
  245. </div>
  246. </div>
  247. </div>
  248. </div>
  249. <div class="section" id="how-to-update">
  250. <h2><a class="toc-backref" href="#id10">How to update</a><a class="headerlink" href="#how-to-update" title="Permalink to this headline">¶</a></h2>
  251. <div class="code sh highlight-python"><div class="highlight"><pre>cd /usr/local/searx
  252. sudo -u searx -i
  253. . ./searx-ve/bin/activate
  254. git stash
  255. git pull origin master
  256. git stash apply
  257. ./manage.sh update_packages
  258. sudo service uwsgi restart
  259. </pre></div>
  260. </div>
  261. </div>
  262. <div class="section" id="docker">
  263. <h2><a class="toc-backref" href="#id11">Docker</a><a class="headerlink" href="#docker" title="Permalink to this headline">¶</a></h2>
  264. <p>Make sure you have installed Docker. For instance, you can deploy searx like this:</p>
  265. <div class="code sh highlight-python"><div class="highlight"><pre>docker pull wonderfall/searx
  266. docker run -d --name searx -p $PORT:8888 wonderfall/searx
  267. </pre></div>
  268. </div>
  269. <p>Go to <a class="reference external" href="http://localhost:$PORT">http://localhost:$PORT</a>.</p>
  270. <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.</p>
  271. <p>It&#8217;s also possible to build searx from the embedded Dockerfile.</p>
  272. <div class="code sh highlight-python"><div class="highlight"><pre>git clone https://github.com/asciimoo/searx.git
  273. cd searx
  274. docker build -t whatever/searx .
  275. </pre></div>
  276. </div>
  277. </div>
  278. </div>
  279. </div>
  280. </div>
  281. </div>
  282. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  283. <div class="sphinxsidebarwrapper"><div class="sidebar_container body">
  284. <h1>Searx</h1>
  285. <ul>
  286. <li><a href="../../index.html">Home</a></li>
  287. <li><a href="https://github.com/asciimoo/searx">Source</a></li>
  288. <li><a href="https://github.com/asciimoo/searx/wiki">Wiki</a></li>
  289. <li><a href="https://github.com/asciimoo/searx/wiki/Searx-instances">Public instances</a></li>
  290. </ul>
  291. <hr />
  292. <ul>
  293. <li><a href="https://twitter.com/Searx_engine">Twitter</a></li>
  294. <li><a href="https://flattr.com/submit/auto?user_id=asciimoo&url=https://github.com/asciimoo/searx&title=searx&language=&tags=github&category=software">Flattr</a></li>
  295. <li><a href="https://gratipay.com/searx">Gratipay</a></li>
  296. </ul>
  297. </div>
  298. </div>
  299. </div>
  300. <div class="clearer"></div>
  301. </div>
  302. <div class="footer">
  303. &copy; Copyright 2015, Adam Tauber.
  304. </div>
  305. </body>
  306. </html>