installation.html 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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="Search API" href="../search_api.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>Installation<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="section" id="basic-installation">
  39. <h2>Basic installation<a class="headerlink" href="#basic-installation" title="Permalink to this headline">¶</a></h2>
  40. <p>For Ubuntu, be sure to have enable universe repository.</p>
  41. <p>Install packages :</p>
  42. <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
  43. </pre></div>
  44. </div>
  45. <p>Install searx :</p>
  46. <div class="code sh highlight-python"><div class="highlight"><pre>cd /usr/local
  47. sudo git clone https://github.com/asciimoo/searx.git
  48. sudo useradd searx -d /usr/local/searx
  49. sudo chown searx:searx -R /usr/local/searx
  50. </pre></div>
  51. </div>
  52. <p>Install dependencies in a virtualenv :</p>
  53. <div class="code sh highlight-python"><div class="highlight"><pre>sudo -u searx -i
  54. cd /usr/local/searx
  55. virtualenv searx-ve
  56. . ./searx-ve/bin/activate
  57. pip install -r requirements.txt
  58. python setup.py install
  59. </pre></div>
  60. </div>
  61. </div>
  62. <div class="section" id="configuration">
  63. <h2>Configuration<a class="headerlink" href="#configuration" title="Permalink to this headline">¶</a></h2>
  64. <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
  65. </pre></div>
  66. </div>
  67. <p>Edit searx/settings.yml if necessary.</p>
  68. </div>
  69. <div class="section" id="check">
  70. <h2>Check<a class="headerlink" href="#check" title="Permalink to this headline">¶</a></h2>
  71. <p>Start searx :</p>
  72. <div class="code sh highlight-python"><div class="highlight"><pre>python searx/webapp.py
  73. </pre></div>
  74. </div>
  75. <p>Go to <a class="reference external" href="http://localhost:8888">http://localhost:8888</a></p>
  76. <p>If everything works fine, disable the debug option in settings.yml :</p>
  77. <div class="code sh highlight-python"><div class="highlight"><pre>sed -i -e &quot;s/debug : True/debug : False/g&quot; searx/settings.yml
  78. </pre></div>
  79. </div>
  80. <p>At this point searx is not demonized ; uwsgi allows this.</p>
  81. <p>You can exit the virtualenv and the searx user bash (enter exit command
  82. twice).</p>
  83. </div>
  84. <div class="section" id="uwsgi">
  85. <h2>uwsgi<a class="headerlink" href="#uwsgi" title="Permalink to this headline">¶</a></h2>
  86. <p>Install packages :</p>
  87. <div class="code sh highlight-python"><div class="highlight"><pre>sudo apt-get install uwsgi uwsgi-plugin-python
  88. </pre></div>
  89. </div>
  90. <p>Create the configuration file /etc/uwsgi/apps-available/searx.ini with
  91. this content :</p>
  92. <div class="highlight-python"><div class="highlight"><pre>[uwsgi]
  93. # Who will run the code
  94. uid = searx
  95. gid = searx
  96. # disable logging for privacy
  97. disable-logging = true
  98. # Number of workers (usually CPU count)
  99. workers = 4
  100. # The right granted on the created socket
  101. chmod-socket = 666
  102. # Plugin to use and interpretor config
  103. single-interpreter = true
  104. master = true
  105. plugin = python
  106. # Module to import
  107. module = searx.webapp
  108. # Virtualenv and python path
  109. virtualenv = /usr/local/searx/searx-ve/
  110. pythonpath = /usr/local/searx/
  111. chdir = /usr/local/searx/searx/
  112. </pre></div>
  113. </div>
  114. <p>Activate the uwsgi application and restart :</p>
  115. <div class="code sh highlight-python"><div class="highlight"><pre>cd /etc/uwsgi/apps-enabled
  116. ln -s ../apps-available/searx.ini
  117. /etc/init.d/uwsgi restart
  118. </pre></div>
  119. </div>
  120. </div>
  121. <div class="section" id="web-server">
  122. <h2>Web server<a class="headerlink" href="#web-server" title="Permalink to this headline">¶</a></h2>
  123. <div class="section" id="with-nginx">
  124. <h3>with nginx<a class="headerlink" href="#with-nginx" title="Permalink to this headline">¶</a></h3>
  125. <p>If nginx is not installed (uwsgi will not work with the package
  126. nginx-light) :</p>
  127. <div class="code sh highlight-python"><div class="highlight"><pre>sudo apt-get install nginx
  128. </pre></div>
  129. </div>
  130. <div class="section" id="hosted-at">
  131. <h4>Hosted at /<a class="headerlink" href="#hosted-at" title="Permalink to this headline">¶</a></h4>
  132. <p>Create the configuration file /etc/nginx/sites-available/searx with this
  133. content :</p>
  134. <div class="code nginx highlight-python"><div class="highlight"><pre>server {
  135. listen 80;
  136. server_name searx.example.com;
  137. root /usr/local/searx;
  138. location / {
  139. include uwsgi_params;
  140. uwsgi_pass unix:/run/uwsgi/app/searx/socket;
  141. }
  142. }
  143. </pre></div>
  144. </div>
  145. <p>Restart service :</p>
  146. <div class="code sh highlight-python"><div class="highlight"><pre>sudo service nginx restart
  147. sudo service uwsgi restart
  148. </pre></div>
  149. </div>
  150. <div class="section" id="from-subdirectory-url-searx">
  151. <h5>from subdirectory URL (/searx)<a class="headerlink" href="#from-subdirectory-url-searx" title="Permalink to this headline">¶</a></h5>
  152. <p>Add this configuration in the server config file
  153. /etc/nginx/sites-available/default :</p>
  154. <div class="code nginx highlight-python"><div class="highlight"><pre>location = /searx { rewrite ^ /searx/; }
  155. location /searx {
  156. try_files $uri @searx;
  157. }
  158. location @searx {
  159. uwsgi_param SCRIPT_NAME /searx;
  160. include uwsgi_params;
  161. uwsgi_modifier1 30;
  162. uwsgi_pass unix:/run/uwsgi/app/searx/socket;
  163. }
  164. </pre></div>
  165. </div>
  166. <p>Enable base_url in searx/settings.yml</p>
  167. <div class="highlight-python"><div class="highlight"><pre>base_url : http://your.domain.tld/searx/
  168. </pre></div>
  169. </div>
  170. <p>Restart service :</p>
  171. <div class="code sh highlight-python"><div class="highlight"><pre>sudo service nginx restart
  172. sudo service uwsgi restart
  173. </pre></div>
  174. </div>
  175. </div>
  176. <div class="section" id="disable-logs">
  177. <h5>disable logs<a class="headerlink" href="#disable-logs" title="Permalink to this headline">¶</a></h5>
  178. <p>for better privacy you can disable nginx logs about searx.</p>
  179. <p>how to proceed : below <code class="docutils literal"><span class="pre">uwsgi_pass</span></code> in
  180. /etc/nginx/sites-available/default add</p>
  181. <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>
  182. <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>
  183. </pre></div>
  184. </div>
  185. <p>Restart service :</p>
  186. <div class="code sh highlight-python"><div class="highlight"><pre>sudo service nginx restart
  187. </pre></div>
  188. </div>
  189. </div>
  190. </div>
  191. </div>
  192. </div>
  193. <div class="section" id="with-apache">
  194. <h2>with apache<a class="headerlink" href="#with-apache" title="Permalink to this headline">¶</a></h2>
  195. <p>Add wsgi mod :</p>
  196. <div class="code sh highlight-python"><div class="highlight"><pre>sudo apt-get install libapache2-mod-uwsgi
  197. sudo a2enmod uwsgi
  198. </pre></div>
  199. </div>
  200. <p>Add this configuration in the file /etc/apache2/apache2.conf :</p>
  201. <div class="code apache highlight-python"><div class="highlight"><pre>&lt;Location /&gt;
  202. Options FollowSymLinks Indexes
  203. SetHandler uwsgi-handler
  204. uWSGISocket /run/uwsgi/app/searx/socket
  205. &lt;/Location&gt;
  206. </pre></div>
  207. </div>
  208. <p>Note that if your instance of searx is not at the root, you should
  209. change <code class="docutils literal"><span class="pre">&lt;Location</span> <span class="pre">/&gt;</span></code> by the location of your instance, like
  210. <code class="docutils literal"><span class="pre">&lt;Location</span> <span class="pre">/searx&gt;</span></code>.</p>
  211. <p>Restart Apache :</p>
  212. <div class="code sh highlight-python"><div class="highlight"><pre>sudo /etc/init.d/apache2 restart
  213. </pre></div>
  214. </div>
  215. </div>
  216. <div class="section" id="id1">
  217. <h2>disable logs<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
  218. <p>For better privacy you can disable Apache logs.</p>
  219. <p>WARNING : not tested</p>
  220. <p>WARNING : you can only disable logs for the whole (virtual) server not
  221. for a specific path.</p>
  222. <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>
  223. <div class="code apache highlight-python"><div class="highlight"><pre>CustomLog /dev/null combined
  224. </pre></div>
  225. </div>
  226. <p>Restart Apache :</p>
  227. <div class="code sh highlight-python"><div class="highlight"><pre>sudo /etc/init.d/apache2 restart
  228. </pre></div>
  229. </div>
  230. </div>
  231. <div class="section" id="how-to-update">
  232. <h2>How to update<a class="headerlink" href="#how-to-update" title="Permalink to this headline">¶</a></h2>
  233. <div class="code sh highlight-python"><div class="highlight"><pre>cd /usr/local/searx
  234. sudo -u searx -i
  235. . ./searx-ve/bin/activate
  236. git stash
  237. git pull origin master
  238. git stash apply
  239. pip install --upgrade -r requirements.txt
  240. sudo service uwsgi restart
  241. </pre></div>
  242. </div>
  243. </div>
  244. </div>
  245. </div>
  246. </div>
  247. </div>
  248. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  249. <div class="sphinxsidebarwrapper"><div class="sidebar_container body">
  250. <h1>Searx</h1>
  251. <ul>
  252. <li><a href="../../index.html">Home</a></li>
  253. <li><a href="https://github.com/asciimoo/searx">Source</a></li>
  254. <li><a href="https://github.com/asciimoo/searx/wiki">Wiki</a></li>
  255. <li><a href="https://github.com/asciimoo/searx/wiki/Searx-instances">Public instances</a></li>
  256. </ul>
  257. <hr />
  258. <ul>
  259. <li><a href="https://twitter.com/Searx_engine">Twitter</a></li>
  260. <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>
  261. <li><a href="https://gratipay.com/searx">Gratipay</a></li>
  262. </ul>
  263. </div>
  264. </div>
  265. </div>
  266. <div class="clearer"></div>
  267. </div>
  268. <div class="footer">
  269. &copy; Copyright 2015, Adam Tauber.
  270. </div>
  271. </body>
  272. </html>