How can I install Tor from the source code in the Git repository?

  • It is sometimes desirable to compile Tor from source, and perhaps run an unreleased version (e.g., to test the latest changes, use new features unavailable in the latest release, etc.). What is the procedure for doing so?

  • mrphs

    mrphs Correct answer

    9 years ago

    To compile and install Tor from git follow these steps:

    Step 0: Make sure you have git, a working "C compiler" and "GNU make" installed on your linux box. You also need libevent-dev and libssl-dev libraries before you start.

    If you're on debian/ubuntu type:

     sudo apt-get install git build-essential automake libevent-dev libssl-dev zlib1g-dev
    
    • Step 1: Clone Tor from git.torproject.org

      git clone https://git.torproject.org/tor.git

    • Step 2: cd tor

    • Step 3: run ./autogen.sh
    • Step 4: run ./configure or ./configure --disable-asciidoc if you don't want to build the manpages.
      (See 'note' if you get error at this step)
    • Step 5: run make
    • Step 6 (optional): run make install

    Note: If you have problems finding libraries at step 4 try the following instead:

    CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" \ ./configure
    

    or

    ./configure --with-libevent-dir=/usr/local
    

    And if you have mysterious autoconf failures while linking openssl, consider setting your LD_LIBRARY_PATH to the openssl lib directory.

    For example: setenv LD_LIBRARY_PATH /usr/your_username/lib.

    see INSTALL for more details.

    I very rarely make install at the end. Once I've run make, I have a src/or/tor binary and I can just run it in place. That way I don't have to worry about smearing anything over my filesystem.

    I added "make install" just to fit the question. Maybe it'd be better to change the question to "How to compile Tor from git?" and remove "make install"?

    Your INSTALL link points to the latest commit, which is not very helpful.

    Is there an instruction how to run it with systemd?

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM

Tags used