Hello friends,
Any popular Search Engine you know like Google, Bing, Yahoo and even Duckduckgo is tracking you whenever you search for anything on it. So there is no privacy for us. But wait, In this blog we will Build our own private Search Engine and the best thing is that you don't need any PC or Laptop for this, you just need your smartphone.
We will be using SearXng to do this. SearXNG is a privacy respected Search Engine that can be hosted on your local machine. Basically it aggregates results from various search services and databases . and here you are never tracked as it is hosted on your private machine.
Prerequisite
Any Debian based Linux Distro Here I will be using Kali Linux in Termux.
Installation
First of all if login to your linux distro here
proot-distro login kali
Next we need to install its dependencies
sudo apt install python3-dev python3-babel python3-venv uwsgi uwsgi-plugin-python3 git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev
Now we will create a user for it
sudo -H useradd --shell /bin/bash --system --home-dir "/usr/local/searxng" searxng
Give permissions to the user
sudo -H mkdir "/usr/local/searxng"
sudo -H chown -R "searxng:searxng" "/usr/local/searxng"
Start a new shell with created user
sudo -H -u searxng -i
Now clone the Searxng repository
git clone "https://github.com/searxng/searxng" "/usr/local/searxng/searxng-src"
Now create a virtual environment in the same shell
python3 -m venv "/usr/local/searxng/searx-pyenv"
echo ". /usr/local/searxng/searx-pyenv/bin/activate" \ >> "/usr/local/searxng/.profile"
Now exit from the session
exit
and start it again
sudo -H -u searxng -i
Now check if virtualenv is logged in with .profile
command -v python && python --version
Next we need to install dependencies, execute following commands one by one to install it
pip install -U pip
pip install -U setuptools
pip install -U wheel
pip install -U pyyaml
cd "/usr/local/searxng/searxng-src"
pip install -e .
If you get error with the above command then just execute it again
Now open a new terminal, In termux swipe from left to right and click on new session and login to your linux distro and execute following commands
sudo -H mkdir -p "/etc/searxng"
sudo -H cp "/usr/local/searxng/searxng-src/utils/templates/etc/searxng/settings.yml" "/etc/searxng/settings.yml"
sudo -H sed -i -e "s/debug : False/debug : True/g" "/etc/searxng/settings.yml"
sudo -H -u searxng -i
cd /usr/local/searxng/searxng-src/
Now open setting.yml file with a text editor
nano /etc/searxng/settings.yml
and change the secret_key from ultrasecretkey to whatever you want and save the file
Now make settings.yml to default settings
export SEARXNG_SETTINGS_PATH=/etc/searxng/settings.yml
And finally start the search engine
python searx/webapp.py
Now open your browser and go to http://127.0.0.1:8888,
In termux you can execute following
termux-open-url http://127.0.0.1:8888
Congrats you have successfully build your own private search engine.
To stop searxng use CTRL and C.