本教程將向您展示如何 在 Ubuntu 20.04 上安裝 uTorrent它還包含以下說明: 自動啟動 uTorrent 服務器 對於那些想通過域名訪問 uTorrent 的人,如何在 Ubuntu 上使用 Nginx 設置反向代理 Apache Web 服務器。
注意:適用於 Linux 的 uTorrent 客戶端已 7 年未更新。 我們建議在 Ubuntu 上安裝 Deluge BitTorrent 客戶端。
Linux 本機 uTorrent 客戶端是一個基於 Web 的應用程序。這意味著在您的網絡瀏覽器中使用 uTorrent。這個應用程序的全稱是uTorrent Server,它的功能是:
- 分佈式哈希表 (DHT)
- UPnP 端口映射
- NAT-PMP 端口映射
- 上傳速率限制
- 下載速率限制
- 柱子
- 同時對等上傳的可配置限制
- 增量文件分配
- 塊級揀貨
- 用於檢查和下載文件的單獨線程
- 用於多個 torrent 下載的單線程和單端口
- BitTorrent 擴展協議
- 多跟踪器擴展支持
- 擴大公平貿易
- 緊湊型跟踪器擴展
- 快速簡歷
- 無法快速恢復時對 torrent 文件進行隊列檢查
- HTTP 洪流支持
- 從其他 BitTorrent 客戶端恢復部分下載
- 文件大小超過 2GB
- 有選擇地下載多個文件種子
- IPv6
- 高性能網絡堆棧
- uTP – 具有動態擁塞控制的基於 UDP 的高級傳輸
如何在 Ubuntu 20.04 上安裝 uTorrent
最新版本的 Linux 版 uTorrent 已針對 Ubuntu 13.04 發布,但您仍然可以在 Ubuntu 20.04 LTS 上運行它。訪問 uTorrent Linux 下載頁面並下載適用於 Ubuntu 13.04 的 uTorrent 服務器包。
或者,您可以通過打開終端窗口並運行以下命令從命令行下載它:
64 位
wget https://download-hr.utorrent.com/track/beta/endpoint/utserver/os/linux-x64-ubuntu-13-04 -O utserver.tar.gz
32 位
wget https://download-hr.utorrent.com/track/beta/endpoint/utserver/os/linux-i386-ubuntu-13-04 -O utserver.tar.gz
下載後,將工作目錄更改為下載 uTorrent 服務器文件的目錄。然後運行以下命令解壓 tar.gz
歸檔到 /opt/
目錄。
sudo tar xvf utserver.tar.gz -C /opt/
然後運行以下命令來安裝所需的依賴項:
sudo apt install libssl-dev wget https://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.3_amd64.deb sudo apt install ./libssl1.0.0_1.0.2n-1ubuntu5.3_amd64.deb
安裝依賴項後,創建一個符號鏈接。
sudo ln -s /opt/utorrent-server-alpha-v3_3/utserver /usr/bin/utserver
使用以下命令啟動 uTorrent 服務器:默認情況下,uTorrent 服務器會監聽。 0.0.0.0:8080
如果另一個服務也在監聽 8080 端口,您應該暫時停止該服務。 uTorrent 也使用端口 10000 和 6881。 -daemon
在後台運行 uTorrent 服務器的選項。
utserver -settingspath /opt/utorrent-server-alpha-v3_3/ -daemon
您現在可以通過在 Web 瀏覽器的地址欄中輸入以下文本,在瀏覽器中訪問 uTorrent Web UI:
your-server-ip:8080/gui
如果本地計算機上安裝了 uTorrent, your-server-ip
什麼時候 localhost
.
localhost:8080/gui
如果你的 Ubuntu 服務器有防火牆,你需要允許訪問端口 8080 和 6881。例如,如果您使用的是 UFW,請運行以下兩個命令來打開端口 8080 和 6881:
sudo ufw allow 8080/tcp sudo ufw allow 6881/tcp
筆記 /gui
在 URL 中是必需的。否則,您將收到無效請求錯誤。出現提示時輸入您的用戶名和密碼 admin
的[ユーザー名]填寫該字段並[パスワード]把這一塊留白。
登錄後,您需要更改管理員。點擊齒輪圖標[パスワード]選擇。 Web UI
它在左側的菜單中。您可以更改您的用戶名和密碼。這比使用更安全 admin
作為用戶名。
如果您有其他服務在端口 8080 上偵聽, Connectivity
部分,您可以將 uTorrent 監聽端口更改為另一個端口,例如 8081。更改端口後,您需要使用以下命令重新啟動 uTorrent 服務器:
sudo pkill utserver utserver -settingspath /opt/utorrent-server-alpha-v3_3/ &
可以設置默認下載目錄 Directories
標籤。
在 Ubuntu 上自動啟動 uTorrent 服務器
要啟用自動啟動,請使用以下命令創建 systemd 服務: (Nano 是一個命令行文本編輯器。)
sudo nano /etc/systemd/system/utserver.service
將以下文本放入文件中。 請注意,uTorrent 是使用 systemd 啟動的,因此不需要它。 -daemon
引導命令的選項。
[Unit] Description=uTorrent Server After=network.target [Service] Type=simple User=utorrent Group=utorrent ExecStart=/usr/bin/utserver -settingspath /opt/utorrent-server-alpha-v3_3/ ExecStop=/usr/bin/pkill utserver Restart=always SyslogIdentifier=uTorrent Server [Install] WantedBy=multi-user.target
根據 Ctrl+O
按 Enter
保存您的文檔。根據 Ctrl+X
結束。然後重新加載systemd。
sudo systemctl daemon-reload
不建議以 root 身份運行 uTorrent 服務器,因此請在 services 文件中運行 uTorrent 服務器。 utorrent
沒有 root 權限的用戶和組。創造 utorrent
系統用戶和組使用以下命令:
sudo adduser --system --group utorrent
接下來,停止您當前的 uTorrent 服務器。
sudo pkill utserver
使用 systemd 服務啟動 uTorrent 服務器。
sudo systemctl start utserver
啟動時啟用自動啟動。
sudo systemctl enable utserver
現在檢查 utserver 的狀態。
systemctl status utserver
您可以看到自動啟動已啟用並且 uTorrent 服務器正在運行。創建時 utorrent
創建用戶和主目錄 /home/utorrent/
utorrent 用戶具有寫入權限,因此我們建議將此主目錄設置為 torrent 下載目錄。它還需要 utorrent 作為所有者 /opt/utorrent-server-alpha-v3_3/
在目錄中運行以下命令:
sudo chown utorrent:utorrent /opt/utorrent-server-alpha-v3_3/ -R
我們建議在下載種子時使用 VPN 隱藏您的 IP 地址。
- 如何在 Linux 桌面上安裝和使用 ProtonVPN
注意:其餘材料適用於對 Web 服務器和 DNS 記錄有基本了解的人。 如果您不知道您的 Apache/Nginx 或 DNS A 記錄是什麼,則無需執行這些步驟。
配置 Nginx 反向代理
配置 Nginx 反向代理以使用您的域名從遠程連接訪問您的 uTorrent 服務器。
子目錄結構
如果您的 Ubuntu 服務器上已經有一個 Nginx 服務的網站,您可以配置您現有的 Nginx 服務器塊以從您的域名的子目錄訪問 uTorrent Web UI。
sudo nano /etc/nginx/conf.d/your-website.conf
將以下指令粘貼到服務器塊中:如果您之前更改了端口,您也應該在此處更改它。
location /gui { proxy_pass https://localhost:8080; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }
保存並關閉文件。接下來,測試您的 Nginx 配置。
sudo nginx -t
測試成功後,重新加載Nginx。
sudo systemctl reload nginx
您現在可以訪問 uTorrent Web UI。
your-domain.com/gui
子域配置
如果您的 Ubuntu 服務器沒有現有網站,您將需要創建一個新的服務器塊文件。 在 Ubuntu 20.04 或 Ubuntu 19.04 上安裝 Nginx。
sudo apt install nginx
啟動 Nginx 網絡服務器。
sudo systemctl start nginx
然後創建一個新的服務器塊文件 /etc/nginx/conf.d/
目錄。
sudo nano /etc/nginx/conf.d/utserver-proxy.conf
將以下文本粘貼到文件中。交換 utorrent.your-domain.com
使用您選擇的子域,不要忘記為其創建 A 記錄。
server {
listen 80;
server_name utorrent.your-domain.com;
error_log /var/log/nginx/uttorrent.error;
location /gui {
proxy_pass https://localhost:8080;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
保存並關閉文件。接下來,測試您的 Nginx 配置。
sudo nginx -t
測試成功後,重新加載Nginx。
sudo systemctl reload nginx
您現在可以訪問 uTorrent Web UI。
utorrent.your-domain.com/gui
配置 Apache 反向代理
如果您使用的是 Apache Web 服務器而不是 Nginx,請按照以下步驟設置反向代理。
安裝 Apache Web 服務器。
sudo apt install apache2
要將 Apache 用作反向代理,必須啟用它。 proxy
模塊,也啟用 rewrite
模塊。
sudo a2enmod proxy proxy_http rewrite
接下來,為 uTorrent 創建一個虛擬主機文件。
sudo nano /etc/apache2/sites-available/utorrent.conf
將以下配置放入文件中:交換 utorrent.your-domain.com
不要忘記使用您的真實域名並設置A記錄。
<VirtualHost *:80>
ServerName utorrent.your-domain.com
RewriteEngine on
RewriteRule ^/gui(/?)(.*)$ /$2 [PT]
ProxyPreserveHost on
ProxyPass / https://127.0.0.1:8080/gui/
ProxyPassReverse / https://127.0.0.1:8080/gui/
</VirtualHost>
保存並關閉文件。然後啟用這個虛擬主機。
sudo a2ensite utorrent.conf
重新啟動 Apache 以使更改生效。
sudo systemctl restart apache2
現在子域(utorrent.your-domain.com
) 在瀏覽器的地址欄中。 如果 uTorrent Web UI 未加載,您可能需要刪除默認虛擬主機文件並重新啟動 Apache Web 服務器。
啟用 HTTPS
要加密您的 HTTP 流量,請通過安裝 Let’s Encrypt 頒發的免費 TLS 證書來啟用 HTTPS。通過運行以下命令在 Ubuntu 20.04 或 Ubuntu 19.04 服務器上安裝 Let’s Encrypt 客戶端 (certbot):
sudo apt install certbot
如果你使用 Nginx,你還應該安裝 Certbot Nginx 插件。
sudo apt install python3-certbot-nginx
然後運行以下命令來獲取並安裝 TLS 證書:
sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d utorrent.your-domain.com
如果您使用 Apache,請安裝 Certbot Apache 插件。
sudo apt install python3-certbot-apache
運行此命令以獲取並安裝 TLS 證書。
sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d utorrent.your-domain.com
在哪裡
--nginx
: 使用 nginx 插件。--apache
: 使用 Apache 注入。--agree-tos
: 我同意使用條款。--redirect
:強制 HTTPS 超過 301 重定向。--hsts
:將 Strict-Transport-Security 標頭添加到所有 HTTP 響應。強制瀏覽器始終對域使用 TLS。 防禦 SSL/TLS 剝離。--staple-ocsp
:啟用 OCSP 裝訂。有效的 OCSP 響應被裝訂到 TLS 期間服務器提供的證書。
將自動獲取並安裝證書。
現在您應該可以通過以下方式訪問 uTorrent 服務器: https://utorrent.your-domain.com/gui
.
如何在 Ubuntu 上卸載 uTorrent
要刪除 uTorrent,首先要停止當前的 uTorrent 進程。
sudo pkill utserver
然後刪除安裝目錄。
sudo rm -r /opt/utorrent-server-alpha-v3_3/
刪除符號鏈接。
sudo rm /usr/bin/utserver
包起來
我希望本教程能幫助您在 Ubuntu 20.04 LTS 上安裝 uTorrent。 另請參閱我們關於如何在 Ubuntu 上安裝 Deluge 或 qBitTorrent 的教程。與往常一樣,如果您發現本文對您有幫助,請註冊我們的免費時事通訊以獲取提示和技巧。照顧好自己?