Attention: These instructions are meant for installing tor the network daemon i.e. little-t-tor. 有关安装Tor浏览器的说明,请参阅Tor Browser用户手册

管理员权限:要安装 Tor,您需要 root 权限。 以下所有需要以 root 用户身份运行的命令,如 apt 和 dpkg,在前面加上“#”,而作为用户运行的命令则用 “$” 表示终端中的标准提示符。 要打开一个 root 终端,你有几个选项:sudo su,或者 sudo -i,或者 su -i。请注意,sudo 会要求你的用户密码,而 su 则需要系统的 root 密码。

Debian / Ubuntu

不要使用 Ubuntu Universe 源中的软件包。 过去它们没有可靠地进行更新。这意味着您可能会错过稳定性和安全修复程序。

  • Configure Tor package repository

Enable the Tor Project APT repository by following the instructions.

  • Package installation

# apt install tor

Fedora

  • Configure Tor Package repository

Enable the Tor Project's RPM package repository by following the instructions.

  • Package installation

# dnf install tor

FreeBSD

  • Package installation

# pkg install tor

OpenBSD

  • Package installation

# pkg_add tor

macOS

  • Install a package manager

在 OS X 上有两个软件包管理器:Homebrew 和 Macports。 你可以使用你喜欢的软件包管理工具。

要安装 Homebrew,请按照 brew.sh 上的说明进行操作。

要安装 Macports,请按照 macports.org/install.php 上的说明操作。

  • Package installation

如果你在终端窗口中使用 Homebrew,请运行:

# brew install tor

如果您在终端窗口中使用 Macports,请运行:

$ sudo port install tor

Arch Linux

  • To install the tor package on Arch Linux, run:
# pacman -Syu tor

DragonFlyBSD

  • Bootstrap pkg

DragonFlyBSD's daily snapshots and releases (starting with 3.4) come with pkg already installed. Upgrades from earlier releases, however, will not have it. If pkg is missing on the system for any reason, it can be quickly bootstrapped without having to build it from source or even having DPorts installed:

# cd /usr
# make pkg-bootstrap
# rehash
# pkg-static install -y pkg
# rehash
  • Recommended steps to setup pkg

Here, it will be similar to what we have on a FreeBSD system, and we are going to use HTTPS to fetch our packages, and updates - so here we also need an extra package to help us out (ca_root_nss).

安装ca_root_nss软件包:

# pkg install ca_root_nss

For fresh installations, the file /usr/local/etc/pkg/repos/df-latest.conf.sample is copied to /usr/local/etc/pkg/repos/df-latest. The files ending in the ".sample" extension are ignored; pkg(8) only reads files that end in ".conf" and it will read as many as it finds.

DragonflyBSD has 2 packages repositories:

  • Avalon (mirror-master.dragonflybsd.org);
  • Wolfpond (pkg.wolfpond.org).

We can simply edit the URL used to point out the repositories on /usr/local/etc/pkg/repos/df-latest and that's it! Remember to use pkg+https:// for Avalon.

After applying all these changes, we update the packages list again and try to check if there's already a new update to apply:

# pkg update -f
# pkg upgrade -y -f
  • Package installation

安装tor软件包:

# pkg install tor

NetBSD

  • Setup pkg_add

Modern versions of the NetBSD operating system can be set to use pkgin, which is a piece of software aimed to be like apt or yum for managing pkgsrc binary packages. We are not convering its setup here, and opt to use plain pkg_add instead.

# echo "PKG_PATH=http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/$(uname -r)/All" > /etc/pkg_install.conf
  • Package installation

安装torNetBSD的软件包:

# pkg_add tor

Void Linux

To install the tor package on Void Linux, please run:

# xbps-install -S tor

Installing Tor from source

  • Download latest release and dependencies

Tor 的最新版本可以在下载页面找到。

如果你正在从源代码构建,请先安装 libevent,并确保你已经安装了 openssl 和 zlib(包括适用的-devel 软件包)。

  • Install Tor

    tar -xzf tor-0.4.3.6.tar.gz; cd tor-0.4.3.6

    ./configure && make

现在你可以将 tor 作为 src/app/tor 运行(0.4.3.x及更高版本),或者你可以运行make install(如果需要,以 root 身份)将其安装到 /usr/local/ 中,然后只需运行 tor 即可启动它。