19

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?

mirimir
  • 3,017
  • 1
  • 19
  • 29
mrphs
  • 2,754
  • 4
  • 21
  • 34

3 Answers3

21

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.

mrphs
  • 2,754
  • 4
  • 21
  • 34
1

UPDATE (after Roger Dingledine's comment):

Please, do not use the "--enable-bufferevents" feature for stable installations. It's not mature yet.

The --enable-bufferevents option has not ever worked. It is a partial feature that needs somebody to finish it.


./configure --disable-asciidoc

From changelog:

Tor can now optionally build with the "bufferevents" buffered IO backend provided by Libevent 2. To use this feature, make sure you have the latest possible version of Libevent, and pass the --enable-bufferevents flag to configure when building Tor from source. This feature will make our networking code more flexible, let us stack layers on each other, and let us use more efficient zero-copy transports where available.

Roya
  • 3,240
  • 3
  • 19
  • 40
nergeia
  • 153
  • 5
1

Git source is really easy stuff for install tor. But I want to tell the easiest alternative way for installing tor from official tor source code. This following commands for Centos. If you're using other Linux, install libevent-devel, groupinstall 'Development Tools' from your default package manager(apt-get or any other).

root @ Centos.

  • Step 1:wget https://dist.torproject.org/tor-0.4.3.4-rc.tar.gz
  • Step 2:tar -xf tor-0.4.3.4-rc.tar.gz and mv tor-0.4.3.4-rc tor
  • Step 3:sudo yum groupinstall 'Development Tools'
  • Step 4:yum install libevent-devel
  • Step 5:cd tor
  • Step 6:./configure
  • Step 7:make
  • Step 8:make install
  • Step 9:run tor

I hope this answer will helps you.