← Back to Home

SearXNG — Local Private Search

SearXNG

This page contains the complete expanded guide shown in my video. Here you will find the real working procedure to install SearXNG locally, configure it correctly, integrate Tor, and make it start automatically at login.

This is not theory. This guide was built by actually installing and debugging SearXNG on Void Linux in real time.

⚠️ DISCLAIMER
Do not paste commands blindly. Read them. Understand them. If something looks different on your system, stop and think. I show working commands, but your responsibility remains yours.

1. What SearXNG Really Is

SearXNG is not a traditional search engine. It does not crawl the web. It does not index pages. It does not own massive databases. It is a meta search engine. It asks other engines for results, cleans them, merges them, and shows them to you.

When running locally, your browser never talks directly to Google, Bing or DuckDuckGo. It talks only to SearXNG on localhost. SearXNG then talks to external engines. They never see your browser, your cookies, your profile or your history.

This changes the tracking model completely. You are no longer the product. You are again the user.

2. Base Requirements

On minimal distributions some Python dependencies must be compiled. Before installing SearXNG you need a working build environment.

On Void Linux:

sudo xbps-install -Sy base-devel cmake pkg-config python3-devel

On Debian, Ubuntu, Mint:

sudo apt install build-essential cmake pkg-config python3-dev

Once these are installed, SearXNG dependencies compile correctly.

3. Cloning the Project

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

4. Creating the Virtual Environment

python3 -m venv venv
source venv/bin/activate

If your prompt shows (venv), you are inside the environment.

5. Installing Dependencies and SearXNG

First install external dependencies:

python -m pip install -r requirements.txt

Then install SearXNG itself inside the virtual environment:

python -m pip install -e . --no-build-isolation

This second command is mandatory. Without it Python will throw ModuleNotFoundError: No module named 'searx'.

6. Configuration Backup

cp searx/settings.yml searx/settings.yml.bak

7. Generating the Secret Key

KEY="$(python3 -c 'import secrets; print(secrets.token_hex(32))')" && echo "$KEY"

Insert the key automatically:

sed -i 's/^\([[:space:]]*secret_key:\).*/\1 "'"$KEY"'"/' searx/settings.yml

8. Binding Only to Localhost

sed -i '/^server:$/,/^general:$/ s/^\([[:space:]]*bind_address:\).*/\1 "127.0.0.1"/' searx/settings.yml

9. Setting the Port

sed -i '/^server:$/,/^general:$/ s/^\([[:space:]]*port:\).*/\1 8888/' searx/settings.yml

10. Enabling Default Internal Settings

grep -q '^use_default_settings:' searx/settings.yml || sed -i '1iuse_default_settings: true\n' searx/settings.yml

11. Verifying Server Section

sed -n '/^server:$/,/^general:$/p' searx/settings.yml | grep -E "bind_address|port|secret_key"

12. Starting SearXNG

cd ~/searxng
source venv/bin/activate
export SEARXNG_SETTINGS_PATH="$PWD/searx/settings.yml"
python searx/webapp.py

If you see:

* Serving Flask app 'webapp'

SearXNG is running.

Open in browser:

http://localhost:8888

13. Installing Tor

Debian / Ubuntu / Mint:

sudo apt update
sudo apt install -y tor
sudo systemctl enable --now tor

Void Linux (runit):

sudo xbps-install -Sy tor
sudo ln -s /etc/sv/tor /var/service

14. Verifying Tor

ss -lntp | grep 9050

Test IP:

curl -s https://ifconfig.me/ip ; echo
curl -s --socks5-hostname 127.0.0.1:9050 https://ifconfig.me/ip ; echo

If IPs differ, Tor works.

15. Configuring SearXNG to Use Tor

sed -i '/^outgoing:$/a\
  proxies:\
    all://: socks5h://127.0.0.1:9050\
  using_tor_proxy: true\
' searx/settings.yml

16. Restart SearXNG

export SEARXNG_SETTINGS_PATH="$PWD/searx/settings.yml"
python searx/webapp.py

If Tor is unreachable, SearXNG refuses to start. If it starts normally, Tor routing is active.

17. Understanding Tor Behaviour

Tor in SearXNG protects the search phase. When clicking a result, the browser connects normally unless you use Tor Browser. Tor in SearXNG = private search. Tor Browser = anonymous browsing.

⚠️ Reality check about Tor and search engines

Tor and SearNGX are not appreciated at all by search engines. They constantly try to block it.

Right now Google works only because of a temporary hack merged by a community user:
https://github.com/searxng/searxng/pull/5644

As you can read here:
https://github.com/searxng/searxng/issues/5286

For months Google stopped working entirely , it will never work with TOR just like other engines .

So let’s be clear:
If you want Google, DuckDuckGo and Brave inside SearXNG, you will likely need to disable Tor.

If you keep Tor enabled, you can still use SearXNG — but you should rely on Startpage. Its results are very close to Google and it currently works reliably through Tor.

I felt it was correct to put you in front of this reality. It’s not all roses and flowers.

18. Making It Start Automatically

systemd

mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/searxng.service <<EOF
[Unit]
Description=SearXNG Local Service

[Service]
Type=simple
WorkingDirectory=%h/searxng
ExecStart=%h/searxng/venv/bin/python %h/searxng/searx/webapp.py
Environment=SEARXNG_SETTINGS_PATH=%h/searxng/searx/settings.yml
Restart=on-failure

[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable --now searxng

Void Linux (runit user service)

mkdir -p ~/.local/sv/searxng
cat > ~/.local/sv/searxng/run <<'EOF'
#!/bin/sh
cd "$HOME/searxng"
. venv/bin/activate
export SEARXNG_SETTINGS_PATH="$HOME/searxng/searx/settings.yml"
exec python searx/webapp.py
EOF
chmod +x ~/.local/sv/searxng/run
ln -s ~/.local/sv/searxng ~/.local/service

⚠️ Important note for Void Linux users

Void Linux does not automatically start user runit services. You must start a user runsvdir instance at login, otherwise services inside ~/.local/service will never run.

This is not a bug in SearXNG. It is how Void Linux handles user services.

Add this autostart entry once:

mkdir -p ~/.config/autostart
cat > ~/.config/autostart/runsvdir-user.desktop <<'EOF'
[Desktop Entry]
Type=Application
Name=runit user services
Exec=sh -lc 'mkdir -p "$HOME/.local/service" "$HOME/.local/sv" ; pgrep -u "$USER" -f "runsvdir.*$HOME/.local/service" >/dev/null || exec runsvdir -P "$HOME/.local/service"'
X-GNOME-Autostart-enabled=true
NoDisplay=true
EOF

After the next login, user runit services will start automatically, and SearXNG will launch at session startup.

19. Setting Browser Search Engine

In Firefox add a new search engine:

http://localhost:8888/search?q=%s

Set it as default search engine.

Conclusion

SearXNG in local mode removes profiling, cookies, tracking and centralized control from your searches. Tor integration removes your real IP from search queries. No domains. No cloud. No external servers. Just you and the web, on your terms.

Comments