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?
3 Answers
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.
-
4I 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. Commented Sep 26, 2013 at 10:10
-
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"?– mrphsCommented Sep 26, 2013 at 13:34
-
1Your INSTALL link points to the latest commit, which is not very helpful.– lorenzogCommented Apr 21, 2015 at 11:32
-
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.
-
What are the "standard" build options? That is, what build options would yield a binary that's closest to the released binary? Where can that information be found?– mirimirCommented Aug 4, 2014 at 20:55
-
@mirimir Good question. I read the script './configure' to realize all the options and its defaults values.– nergeiaCommented Aug 6, 2014 at 9:19
-
Yes, there are many options. Maybe I'm being obtuse. If there are options with defaults, the standard build obviously uses the defaults, right? But even so, I'd like confirmation from someone knowledgeable.– mirimirCommented Aug 6, 2014 at 18:13
-
1Alas, the --enable-bufferevents option has not ever worked. It is a partial feature that needs somebody to finish it. Sorry for the confusion! Commented Sep 24, 2014 at 2:54
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
andmv 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.
-
Tor has a Git repository. You can find it at gitweb.torproject.org/tor.git Commented Apr 24, 2020 at 7:58
-
I could complete all steps successfully. But on running STEP 9 run tor. It runs tor but browser does not opens. Plesse guide Commented Dec 24, 2021 at 18:44