本文采用 CC BY-NC-SA 2.5 CN 协议授权。
转自百度 PT 吧 @Lhao187 戳我进贴
本文所有操作均在 root 环境下进行;开始前请先了解一下文本编辑器 nano 的使用方法:http://man.linuxde.net/nano
编译前准备
安装编译工具
apt-get update && apt-get -y install ca-certificates libcurl4-openssl-dev pkg-config build-essential checkinstall zlib1g-dev intltool
nano /etc/checkinstallrc #搜索 translate 并将值由 1 修改为 0 后保存
下载 libevent 及 transmission 源码
cd /var/tmp
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
wget https://github.com/transmission/transmission-releases/raw/master/transmission-2.93.tar.xz
tar xzf libevent-2.1.8-stable.tar.gz
tar xjf transmission-2.93.tar.xz
rm libevent-2.1.8-stable.tar.gz
rm transmission-2.93.tar.xz
编译与安装
1. 编译 libevent
cd libevent-2.1.8-stable
CFLAGS="-Os -march=native" ./configure && make-j && checkinstall
2. 编译 transmission
需删除的代码片段cd /var/tmp/transmission-2.93
nano libtransmission/fdlimit.c #搜索 SETSIZE,删除下图所示的代码片段后保存。
CFLAGS="-Os -march=native" ./configure && make-j && checkinstall
创建系统服务与修改配置
nano /etc/systemd/system/transmission.service #创建系统服务,粘贴以下斜体内容后保存。
[Unit]
Description=Transmission Bittorrent Daemon
After=network.target
[Service]
User=root
LimitNOFILE=2000000
ExecStart=/usr/local/bin/transmission-daemon -f --log-error -g /root/.config/transmission
[Install]
WantedBy=multi-user.target
systemctl start transmission #启动 transmission 并创建服务配置
systemctl stop transmission #停止 transmission
nano /root/.config/transmission/settings.json #按你的实际需求自行修改 transmission 的配置,不会的自行搜索。
systemctl start transmission # 启动 transmission
systemctl enable transmission #设置开机自动启动 transmission
结束
libevent 和 transmission 的编译目录中都存有 deb 包方便下次安装。如果需要卸载,执行以下命令即可。
dpkg -P transmission libevent-2.1.8
外部链接:
libvent 发版页: https://github.com/libevent/libevent/releases/
transmission 发版页:https://github.com/transmission/transmission-releases
网友评论