7 min read
Private Search Engine
Written by
Abdul Rafay
In today’s world, privacy feels like a joke. No matter how hard you try, if you’re tech-savvy but don’t fully understand what you’re doing, you’re pretty much doomed. Companies like Meta, Google, Microsoft, and others are constantly building profiles on your data to serve you ads. And that’s just the tip of the iceberg. With this sheer amount of data, they can manipulate your mood, your personality, and even your decisions.
That’s terrifying, isn’t it? Someone out there, tweaking how you think and feel? That’s not okay. So, where do we even begin to fight back? For me, it starts with search. I’ve always dreamed of building my own search engine. As a software engineer who loves tinkering with tech and software, it doesn’t feel like an impossible task. I mean, how hard could it really be, right?
But, hold on. I’ve never actually done this before. Building your own search engine sounds cool, but it has to be practical too. I don’t want to dive into a project that just eats up my time and energy without any real payoff. So, before I jump in, here are some burning questions I need to answer:
- What’s the cost of running a search engine? I’m not exactly rolling in cash, so even a few extra dollars can feel like a burden.
- Is it really private, or is that just a scam?
- How easy is it to set up and maintain? Could anyone do this on their own machine, or is it a tech nightmare?
- Can it stay up-to-date automatically? Or will I need to manually update it with the latest web pages and news (because, let’s be honest, that sounds exhausting)?
These are the questions that need answering before I start. If you’re curious too, stick around—we’re going to figure this out together.
How Are We Going to Deploy This Private Search Engine?
To deploy our private search engine, we’re going to use an open-source project called SearXNG. Funny thing is, I didn’t even know about this project at first. After some searching on YouTube, Reddit, and Google, I stumbled across it, and let me tell you—people are raving about it. There’s even a fantastic video by NetworkChuck. If you haven’t seen it yet, do yourself a favor and check it out. It’s a great introduction, and I absolutely loved what he did in that video.
Here’s the kicker about SearXNG: it works best on Linux or Mac. That’s right—most search engines rely on Linux as the base OS, and there’s no way around it. But if you’re on Windows like me, don’t worry! You can use WSL 2 (Windows Subsystem for Linux) or Docker to get things running. That’s exactly what I’ll be doing on my system because, honestly, I’m too lazy to reboot into Linux and disrupt my entire workflow. So, Docker + WSL 2 it is. Wish me luck!
If you haven’t installed Docker or WSL on your machine yet, no problem. Check out the official guides here:
Here’s a polished version of your text while keeping the casual tone intact:
Once you’ve installed WSL, head over to the Microsoft Store and install Ubuntu. If this is your first time setting up WSL, Ubuntu will automatically be installed on your system. Next, we’ll install Docker inside Ubuntu. Yes, I know—it’s a bit of a pain, but trust me, it’s worth it.
To install Docker on Ubuntu, just follow these steps:
Enable Docker in Ubuntu
Run the following commands one by one:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Install Docker
Once the above steps are done, install Docker using this command:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose
Now that Docker is installed, we’re almost there!
Setting Up SearXNG
- Switch to the root user with the following command:
sudo su
Enter your password when prompted.
- Navigate to the
/usr/local
directory:
cd /usr/local
- Clone the SearXNG Docker project:
git clone https://github.com/searxng/searxng-docker.git
- Enter the cloned project directory:
cd searxng-docker
- If you plan to host this search engine on the internet, you’ll need to edit the
.env
file. This file is where you specify the domain you’ll be using and the email address for SSL encryption (via Let’s Encrypt). However, since I’ll be running this on my local machine, I’m skipping this step.
Running the Docker Container
Finally, let’s get this search engine up and running! The Docker container will handle cloning, installing dependencies, and running the project in the background. To start it, run the following command:
sudo docker-compose up -d
Make sure you’re in the directory where the docker-compose.yml
file is located; otherwise, this command won’t work.
To bring down the Docker container, simply run this command in the same folder:
sudo docker-compose down
This command will stop your Docker container.
And that’s it! Your private search engine should now be up and running. If everything worked as expected, you’re one step closer to reclaiming control over your digital privacy.
Access the Search Engine
To access your search engine locally, just open your browser and type localhost
into the address bar. Your search engine should be live and working like a champ, with no issues at all regarding its privacy features.
However, here’s the thing: when I was using WSL with Ubuntu, the Docker container ran fine, but I couldn’t access localhost
. I searched and searched but couldn’t find a solution. Windows sucks. I followed the same process on my Linux machine, and guess what? It worked perfectly.
Customization
Not a fan of the default look or feel? No problem! Customizing SearXNG is straightforward. Inside the searxng
folder, there’s a file called settings.yml
. This is where all the magic happens. Be careful not to touch the other files unless you know what you’re doing.
For a full list of customization options, check out the official SearXNG documentation. There are so many options that even I can’t explain them all here. Dive into the docs, and you’ll be good to go.
Final Thoughts
After spending an hour or two setting this up, I’ve finally got my answers:
- Is it private? Yes, it’s the real deal. When I read about how this search engine works, I was blown away by the level of detail and care the developers put into it.
- Does it cost money? Nope! For me, it didn’t cost a dime, but it will use some of your PC’s performance. If you’ve got an extra machine, even better—zero cost and zero interruptions.
- Does it update automatically? Yes, it does. It handles indexing and keeps everything up-to-date with minimal effort on your part.
- Can the average person set this up? Honestly, with this blog post and NetworkChuck’s video as a guide, yes. It might take you a day to get it running, but it’s absolutely worth it in the end.
I’ll be running this on my Linux machine moving forward because, let’s face it, Windows just doesn’t cut it for projects like this. If you’re serious about privacy, switching to Linux will make your life so much easier.
Until next time—keep coding, nerds! ❤️