Skip to main content

Script Installtion on Debian 11

Prerequisites

Install Git

sudo apt install git

Screenshot 2022-10-24 233503.png

Install curl

sudo apt install curl

Screenshot 2022-10-25 002709.png

Install

Clone the github repository to a local folder.

The official repository is at: https://github.com/searxng/searxng. Documentation can be found at https://docs.searxng.org/admin/installation-scripts.html#installation-scripts

git clone https://github.com/searxng/searxng.git searxng

Screenshot 2022-10-25 000139.png

Change directory into the searxng folder.

cd searxng

Screenshot 2022-10-25 002906.png

Run the official script installer. Details of the script can be found at https://github.com/searxng/searxng/blob/master/utils/searxng.sh

sudo -H ./utils/searxng.sh install all

Screenshot 2022-10-25 003215.png

The script will start off by updating repository and installing the required packages. Once packages are installed, script will pause and ask for user interaction to continue to the next phase, which is creating a searx user.

Press ANY Key to continue.

Screenshot 2022-10-25 003515.png

Cloning source into searx user directory.

Screenshot 2022-10-25 004046.png

Creating python virtual env.

Screenshot 2022-10-25 004142.png

Create initial settings file.

Screenshot 2022-10-25 004338.png

Automated initial testing.

Screenshot 2022-10-25 004454.png

Install uwsgi

Screenshot 2022-10-25 004645.png

Install redis

Screenshot 2022-10-25 004816.png

Screenshot 2022-10-25 004848.png

Screenshot 2022-10-25 005034.png

And finally, the script is finish.

Screenshot 2022-10-25 005110.png

Install Webserver

Before SearXNG can be use, we will need to install a webserver. SearXNG does not have any preference for which web server to use, so choose the web server you're most familiar with. 

I am using NGINX as my web server.server, so for this guide, I will be going over setting up NGINX for SearXNG. SearXNG's official NGINX documentation can be found here: https://docs.searxng.org/admin/installation-nginx.html#installation-nginx 

On Debian 11, you can run the following command to install NGINX from the stable package repository, As of 2022-10-25, the stable package repository contains NGINX version 18.0.

sudo apt install nginx

Screenshot 2022-10-25 221420.png

You can check that NGINX is successfully install by checking the NGINX version.

sudo nginx -v

Screenshot 2022-10-25 221624.png

Using your preferred text editor (like nano), create a new config file for SearXNG at /etc/nginx/sites-availableavailable/ , and paste the following: 

server {
	#Enable this if you want to use plain HTTP
#   Listen 80;    

	#Disable the following if you do not want HTTPS
    listen 443 ssl;
    
    #Domain name of your SearXNG Server
    server_name SearXNG_Server_FQDN;

    #Disable Logs
    access_log /dev/null;
    error_log /dev/null;
    
    #Disable NGINX current version reporting on error pages
	server_tokens off;

    root /var/www/html;
    index index.html index.htm;
	
    #SSL Cert location if you are using HTTPS
    ssl_certificate /etc/ssl/certs/your_SSL_Cert;
    ssl_certificate_key /etc/ssl/private/your_SSL_Cert_Key;

    #Force strong TLS
    ssl_protocols TLSv1.3;
    ssl_prefer_server_ciphers   on;

    #Disable weak ciphers
    ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA HIGH !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";

#    location / {
#        try_files $uri $uri/ = 404;
#    }

    # https://search.example.com/searx
    location / {
        proxy_pass         http://127.0.0.1:4004/;
        proxy_set_header   Host             $http_host;
        proxy_set_header   Connection       $http_connection;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header   X-Scheme         $scheme;
        proxy_set_header   X-Script-Name    /searx;
    }

    location /static {
        alias /usr/local/searx/searx-src/searx/static;
    }

    location /morty {
        proxy_pass         http://127.0.0.1:3000/;
        proxy_set_header   Host             $http_host;
        proxy_set_header   Connection       $http_connection;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header   X-Scheme         $scheme;
    }
}


Screenshot 2022-10-25 230741.png

Screenshot 2022-10-25 230616.png

sudo ln -s /etc/nginx/sites-available/searxng /etc/nginx/sites-enabled/searxng

Test the NGINX config file

sudo nginx -t

Screenshot 2022-10-25 230951.png

Enable NGINX service at boot, and restart NGINX.

#Enable NGINX at boot
sudo systemctl enable nginx

#Restart NGINX
sudo systemctl restart nginx

Screenshot 2022-10-25 231150.png

Testing SearXNG

Once you have your webserver setup, navigate to the website in the browser.