Tor has a clever way of hiding what you do online. When you use the Tor browser, it doesn't directly connect you to websites. Instead, it sends your data through the computers of other Tor users before it reaches the website you want to visit. Think of it like peeling the layers of an onion. This makes it difficult for anyone to determine what you're doing online.
This article gives a clear conception of how onion sites work internally. You can create one for free without purchasing a hostname. We'll use Kali for this tutorial, but you can use any Linux OS.
Let's get started.
Step 1:
Pre-requisite installation
- Install "Tor browser." For Kali Linux, use this command:
sudo apt install -y tor torbrowser-launcher
Then open "Tor browser" if you haven't opened it.
2. Install python3
Step 2:
Open a terminal and make a directory.
mkdir tor
Enter into the directory:
cd tor
Create a html file for the website.
touch index.html
Then
nano index.html
Paste this piece of code:
<html>
<body>
<h1>DARKWEB</h1>
<p>Onion is free!</p>
</body>
</html>
Use keyboard ctrl+o
to write the file and press Enter
then ctrl+x
to exit.
Step 3: Running a Python server on our local machine
- Open another terminal and run.
python3 -m http.server --bind 127.0.0.1 8080
NB: Leave the terminal open to keep the server running
- Now check the website using this URL
http://127.0.0.1:8080/
The site is displayed correctly. So, we will move on to the next step.
Step 4: Launching the website into the Tor network
Open another terminal. For the 'tor' location, run:
whereis tor
There will be multiple directories.
Before going to this directory /etc/tor
, grant your terminal temporary root access.
sudo su
Then do
cd /etc/tor
Run
ls
There will be two files open torrc
, torsocks.conf
nano torrc
Now, remove #
from each of these two line in that file
Change port to 8080
same as our Python server port.
Copy this location /var/lib/tor/hidden_service/
separately
Step 5: Running the service
Open another terminal and enter the root
sudo su
Go to this directory
cd /etc/tor
Then do
sudo tor
Leave the terminal open.
Final step: Retrieving website credentials
Enter into directory
cd /var/lib/tor/hidden_service/
Then do
ls
Run cat
cat hostname
Finally, it is our onion address!!
Now, open "Tor browser" and go to that onion address.
Our site is live in the Tor network!
NB: you can use any cloud/local pc to host the server. The site will be live as long as our localhost is up and running. Credit goes to Shawonmir.
If you’ve found this article helpful, you can support my time and work at Ko-fi ☕ It motivates me to keep going. Take care! 🧡