1.准备工作
(1)安装make工具
sudo apt-get install make
(2)安装gcc
sudo apt-get install build-essential
(3)创建目录
mkdir tor-build
cd tor-build
2.安装libevent
sudo apt-get install libevent-dev
3.安装openssl
sudo apt-get install libssl-dev
4.安装zlib
sudo apt-get install zlib1g-dev
5.编译安装运行tor源码
(1)官网下载源码并且解压
wget http://www.theonionrouter.com/dist/tor-0.3.3.9.tar.gz
tar zxvf tor-0.3.3.9.tar.gz
cd tor-0.3.3.9
(2)运行配置文件
./configure
(3)编译、安装
make install
(4)运行
cd ./src/or
tor
运行结果:
Jul 20 18:55:34.380 [notice] Tor 0.3.3.9 (git-45028085ea188baf) running on Linux with Libevent 2.0.21-stable, OpenSSL 1.0.2g, Zlib 1.2.8, Liblzma N/A, and Libzstd N/A.
Jul 20 18:55:34.000 [warn] You are running Tor as root. You don't need to, and you probably shouldn't.
Jul 20 18:55:34.000 [notice] Bootstrapped 0%: Starting
Jul 20 18:55:34.000 [notice] Starting with guard context "default"
Jul 20 18:55:35.000 [notice] Bootstrapped 5%: Connecting to directory server
Jul 20 18:55:36.000 [notice] Bootstrapped 10%: Finishing handshake with directory server
Jul 20 18:55:37.000 [notice] Bootstrapped 15%: Establishing an encrypted directory connection
Jul 20 18:55:37.000 [notice] Bootstrapped 20%: Asking for networkstatus consensus
Jul 20 18:55:37.000 [notice] Bootstrapped 25%: Loading networkstatus consensus
Jul 20 18:55:39.000 [notice] I learned some more directory information, but not enough to build a circuit: We have no usable consensus.
Jul 20 18:55:39.000 [notice] Bootstrapped 40%: Loading authority key certs
Jul 20 18:55:39.000 [notice] Bootstrapped 45%: Asking for relay descriptors
Jul 20 18:55:39.000 [notice] I learned some more directory information, but not enough to build a circuit: We need more microdescriptors: we have 0/6473, and can only build 0% of likely paths. (We have 0% of guards bw, 0% of midpoint bw, and 0% of exit bw = 0% of path bw.)
Jul 20 18:55:41.000 [notice] Bootstrapped 50%: Loading relay descriptors
Jul 20 18:55:42.000 [notice] Bootstrapped 56%: Loading relay descriptors
Jul 20 18:55:42.000 [notice] Bootstrapped 65%: Loading relay descriptors
Jul 20 18:55:42.000 [notice] Bootstrapped 70%: Loading relay descriptors
Jul 20 18:55:44.000 [notice] Bootstrapped 77%: Loading relay descriptors
Jul 20 18:55:44.000 [notice] Bootstrapped 80%: Connecting to the Tor network
Jul 20 18:55:44.000 [notice] Bootstrapped 85%: Finishing handshake with first hop
Jul 20 18:55:45.000 [notice] Bootstrapped 90%: Establishing a Tor circuit
Jul 20 18:55:46.000 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
Jul 20 18:55:46.000 [notice] Bootstrapped 100%: Done
ps:如果接下来要执行其他命令,因为ctrl+c会结束正在运行的tor进程,所以只能重新开一个窗口。