Home · Guides / 1

Guide 1 of 5

How to create a .onion service

A .onion server needs Linux. These steps use Ubuntu. You can reuse the VM from the address guide, or a host on AWS, Azure, or Alibaba Cloud.

Install Tor

  1. Install Tor from APT.

    sudo apt install tor
    Terminal showing apt install tor completing on Ubuntu
    Installing the Tor package on Ubuntu.
  2. Confirm Tor is listening on port 9050.

    ss -nlt
    ss -nlt output listing a listener on port 9050
    Look for a listener on port 9050.
  3. Check the installed Tor version.

    tor --version
    tor --version printing the installed Tor version string
    Confirm you have a current Tor package.
  4. Compare your public IP with the address seen through Tor.

    Public IP:

    wget -qO - https://api.ipify.org; echo

    Tor IP:

    torsocks wget -qO - https://api.ipify.org; echo
    Two IP lookups, one direct and one via torsocks, showing different addresses
    The two addresses should differ if Tor is working.

Enable the hidden service

  1. Edit Tor’s config file.

    sudo vi /etc/tor/torrc
    Opening /etc/tor/torrc in vi
    The main Tor configuration file.
  2. Scroll until you find these commented lines:

    #HiddenServiceDir /var/lib/tor/hidden_service/
    #HiddenServicePort 80 127.0.0.1:80
  3. Remove the # so the service is enabled:

    HiddenServiceDir /var/lib/tor/hidden_service/
    HiddenServicePort 80 127.0.0.1:80
    torrc hidden service section with HiddenServiceDir and HiddenServicePort uncommented
    Uncomment only the hidden service directory and port 80 lines.
  4. Save and quit vi: press Esc, then type :wq and press Enter.

    vi command line showing :wq to write and quit
    Write the file and exit the editor.
  5. Restart Tor so the hostname keys are created.

    sudo service tor restart
    sudo service tor restart completing with no error
    After a clean restart, Tor publishes the service.