{"id":264,"date":"2023-04-29T23:23:49","date_gmt":"2023-04-29T21:23:49","guid":{"rendered":"https:\/\/gilbert.busana.lu\/?p=264"},"modified":"2023-04-29T23:45:25","modified_gmt":"2023-04-29T21:45:25","slug":"installing-searxng","status":"publish","type":"post","link":"https:\/\/www.homeserver.lu\/?p=264","title":{"rendered":"Installing SearXNG"},"content":{"rendered":"\n<p>If you want to use a meta-search engine that does not track you, <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.searxng.org\" target=\"_blank\">SearXNG<\/a> is an excellent possibility.<\/p>\n\n\n\n<p>To install SearXNG on Ubuntu, I chose to go the docker way described in the official <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/searxng\/searxng-docker\" target=\"_blank\">instructions<\/a>. Unfortunately, I run into some issues, thus deciding to setting up this extended tutorial. I assume you have docker and docker-compose installed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Get searxng-docker<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>cd \/usr\/local\ngit clone https:\/\/github.com\/searxng\/searxng-docker.git\ncd searxng-docker<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Set hostname<\/h2>\n\n\n\n<p>Edit the .env file living in the root foled. Be aware that it is hidden. to see the file, you need to use ls -la. Edit the file with: <em>nano .env<\/em><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-file=\".env\" data-lang=\"Bash\"><code># By default listen on https:\/\/localhost\n# To change this:\n# * uncomment SEARXNG_HOSTNAME, and replace &lt;host&gt; by the SearXNG hostname\n# * uncomment LETSENCRYPT_EMAIL, and replace &lt;email&gt; by your email (require to create a Let&#39;s Encrypt certificate)\n\nSEARXNG_HOSTNAME=searxng.mysite.com\nLETSENCRYPT_EMAIL=myaddress@mysite.com<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Generate your secret key. <\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>sed -i &quot;s|ultrasecretkey|$(openssl rand -hex 32)|g&quot; searxng\/settings.yml<\/code><\/pre><\/div>\n\n\n\n<p>You can see your new key in <em>searxng\/settings.yml<\/em> .<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Adjust IP &amp; port<\/h2>\n\n\n\n<p>To change the IP address and port, you need to edit the docker-compose yaml file.<br><em>nano docker-compose.yml<\/em>.<br>Find the <em>searxng<\/em> chapter and change the <em>127.0.0.1:8080\/8080<\/em> to whatever you prefer. Leaving the standard values (with no port collisions) left me without the ability to access the searXNG engine. So I replaced 127.0.0.1 by 0.0.0.0.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>  searxng:\n    container_name: searxng\n    image: searxng\/searxng:latest\n    networks:\n      - searxng\n    ports:\n     - &quot;0.0.0.0:8888:8080&quot;<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Bring searXNG up<\/h2>\n\n\n\n<p>Check that everything is working<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>docker-compose up<\/code><\/pre><\/div>\n\n\n\n<p>Start the daemon in the background with:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>docker-compose up -d<\/code><\/pre><\/div>\n\n\n\n<p>If you want your searXNG engine to start on boot you need to start it with systemd.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>cp searxng-docker.service.template searxng-docker.service\nsystemctl enable $(pwd)\/searxng-docker.service\nsystemctl start searxng-docker.service<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Run through reverse proxy (optional)<\/h2>\n\n\n\n<p>To avoid using a port number in the URL, I have my NGINX reverse proxy forwarding all requests to the docker image. As I then ran into the &#8220;too many requests&#8221; error, I had to set the <em>limiter<\/em> to <em>false<\/em> in the <em>searxng\/settings-yml<\/em> file . If you want to run your instance outside your intranet, you should definitely protect your searXNG instance with an authentication method to avoid having your server flooded with un uncontrollable amount of requests.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"694\" src=\"https:\/\/gilbert.busana.lu\/wp-content\/uploads\/2023\/04\/searxng-1024x694.png\" alt=\"\" class=\"wp-image-281\" srcset=\"https:\/\/www.homeserver.lu\/wp-content\/uploads\/2023\/04\/searxng-1024x694.png 1024w, https:\/\/www.homeserver.lu\/wp-content\/uploads\/2023\/04\/searxng-300x203.png 300w, https:\/\/www.homeserver.lu\/wp-content\/uploads\/2023\/04\/searxng-768x520.png 768w, https:\/\/www.homeserver.lu\/wp-content\/uploads\/2023\/04\/searxng-1536x1041.png 1536w, https:\/\/www.homeserver.lu\/wp-content\/uploads\/2023\/04\/searxng-624x423.png 624w, https:\/\/www.homeserver.lu\/wp-content\/uploads\/2023\/04\/searxng.png 1916w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">searXNG accessed through reverse proxy<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">To see what containers are running<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>docker container list<\/code><\/pre><\/div>\n\n\n\n<p>It should list your searXNG container:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>CONTAINER ID   IMAGE                     COMMAND                  CREATED             STATUS              PORTS                    NAMES\nYOUR_ID        searxng\/searxng:latest    &quot;\/sbin\/tini -- \/usr\/\u2026&quot;   43 minutes ago      Up 43 minutes       0.0.0.0:8888-&gt;8080\/tcp   searxng     <\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Consulting log files<\/h2>\n\n\n\n<p>To display the logs of all your running containers, use:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>docker-compose logs -f<\/code><\/pre><\/div>\n\n\n\n<p>If you want to only display the logs of one of the specific containers used for searXNG, use one of the following commands:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>docker-compose logs -f caddy\ndocker-compose logs -f searxng\ndocker-compose logs -f redis<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Updating searXNG<\/h2>\n\n\n\n<p>To update your searXNG instance, do the following:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>docker-compose pull\ndocker-compose down\ndocker-compose up<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you want to use a meta-search engine that does not track you, SearXNG is an excellent possibility. To install SearXNG on Ubuntu, I chose to go the docker way described in the official instructions. Unfortunately, I run into some issues, thus deciding to setting up this extended tutorial. I assume you have docker and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[4,20],"tags":[],"class_list":["post-264","post","type-post","status-publish","format-standard","hentry","category-it","category-webapps"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=264"}],"version-history":[{"count":25,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/264\/revisions"}],"predecessor-version":[{"id":294,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/264\/revisions\/294"}],"wp:attachment":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}