-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathseedbox_auto_inst
818 lines (696 loc) · 30.7 KB
/
seedbox_auto_inst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
#!/bin/bash
# PLEASE DO NOT SET ANY OF THE VARIABLES, THEY WILL BE POPULATED IN THE MENU
# Stop when errors, do not place before #!/bin/bash
set -e
sudo passwd root
su
wget -qO- bench.sh | bash
apt-get update; apt-get install smartmontools;
# smartctl -A /dev/sda
smartctl -a -d cciss,0 /dev/sda
smartctl -a -d cciss,1 /dev/sda
# 测速
# 方法1:
su
wget -O speedtest https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest
./speedtest
# 方法2:
su
apt-get -y install iperf3
iperf3 -c ping.online.net
su
apt-get update
apt-get upgrade
# 2. 若版本为14.04,先升级到16.04【否则安装不了BBR】
su
apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get install update-manager-core
do-release-upgrade
# 然后一路y和Enter即可。
su
wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh;chmod +x bbr.sh;./bbr.sh
mkdir -p /lib/firmware/bnx2
wget -O /lib/firmware/bnx2/bnx2-rv2p-09ax-6.0.17.fw https://raw.githubusercontent.com/cernekee/linux-firmware/master/bnx2/bnx2-rv2p-09ax-6.0.17.fw
wget -O /lib/firmware/bnx2/bnx2-rv2p-09-6.0.17.fw https://raw.githubusercontent.com/cernekee/linux-firmware/master/bnx2/bnx2-rv2p-09-6.0.17.fw
wget -O /lib/firmware/bnx2/bnx2-rv2p-06-6.0.15.fw https://raw.githubusercontent.com/cernekee/linux-firmware/master/bnx2/bnx2-rv2p-06-6.0.15.fw
wget -O /lib/firmware/bnx2/bnx2-mips-09-6.2.1b.fw https://raw.githubusercontent.com/cernekee/linux-firmware/master/bnx2/bnx2-mips-09-6.2.1b.fw
wget -O /lib/firmware/bnx2/bnx2-mips-06-6.2.3.fw https://raw.githubusercontent.com/cernekee/linux-firmware/master/bnx2/bnx2-mips-06-6.2.3.fw
reboot
uname -r
# 设置时区
# 方法一 更改所有用户
sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime; date;
# 方法二 更改当前用户
tzselect
#然后输入GST-8是北京时间。需要根据提示将一行加入当前用户的.profile文件方能永久生效
su
apt install ifupdown
## Online, OneProvider, Kimsufi
git clone https://github.com/lovewangbo/ipv6-dhclient-script.git;cd ipv6-dhclient-script;chmod +x ipv6-dhclient-script.sh
echo "IPV6_ADDRESS IPV6_SUBNET IPV6_DUID"
echo "2001:bc8:x:xx::1 56 00:03:xx:xx:xx:xx:xx:xx:xx:xx"
if [[ -z $IPV6_ADDRESS ]]; then
read IPV6_ADDRESS
fi
if [[ -z $IPV6_SUBNET ]]; then
read IPV6_SUBNET
fi
if [[ -z $IPV6_DUID ]]; then
read IPV6_DUID
fi
IPV6_ADDRESS=2001:bc8:32d7:2d00::xxx:xx:x
IPV6_SUBNET=xx
IPV6_DUID=00:xx:00:xx:xx:xx:xx:xx:xx:xx
DEFAULT_INTERFACE=`ip route get 8.8.8.8 | awk '{print $5; exit}'` #获取网卡名称
./ipv6-dhclient-script.sh $DEFAULT_INTERFACE $IPV6_ADDRESS $IPV6_SUBNET $IPV6_DUID
ping6 ipv6.google.com
## ikoula
echo "IPV6_ADDRESS IPV6_SUBNET GATE_WAY"
echo "2a00:c70:1:x:xx:xxx:xxxx:2 96 2a00:c70:1:x:xx:xxx::1"
if [[ -z $IPV6_ADDRESS ]]; then
read IPV6_ADDRESS
fi
if [[ -z $IPV6_SUBNET ]]; then
read IPV6_SUBNET
fi
if [[ -z $GATE_WAY ]]; then
read GATE_WAY
fi
DEFAULT_INTERFACE=`ip route get 8.8.8.8 | awk '{print $5; exit}'` #获取网卡名称
wget -q https://raw.githubusercontent.com/lovewangbo/ipv6-dhclient-script/master/templates/Debian/etc_network_interfaces_ikoula
sed -e "s/{{INTERFACE}}/$DEFAULT_INTERFACE/g" -e "s/{{BLOCK_ADDR}}/$BLOCK_ADDR/g" -e "s/{{BLOCK_SUBNET}}/$BLOCK_SUBNET/g" -e "s/{{GATE_WAY}}/$GATE_WAY/g" etc_network_interfaces_ikoula
mv etc_network_interfaces_ikoula /etc/network/interfaces
# 配置完成后生效
su
DEFAULT_INTERFACE=`ip route get 8.8.8.8 | awk '{print $5; exit}'` #获取网卡名称
ifdown $DEFAULT_INTERFACE && ifup $DEFAULT_INTERFACE
##End
# ipv6 troubleshooting
ping6 ipv6.google.com
# 路由是否正常,可反映链路在何处中断
traceroute6 ipv6.google.com
# 检测过期时间更新是否正常,如不正常将导致一段时间后断线
ip -6 route
# 检测域名解析是否正常
host -t AAAA google.com
# 安装python3并指定为默认版本
sudo apt update
sudo apt install python3
sudo apt install python3-pip
# 最好不要取代默认版本,发现有不少莫名其妙的软件问题(比如加载deluge的插件Itconfig)
# sudo rm -rf /usr/bin/python
# sudo ln -s /usr/bin/python3 /usr/bin/python
# sudo rm -rf /usr/bin/pip
# sudo ln -s /usr/bin/pip3 /usr/bin/pip
# 安装常用的软件包
sudo apt install git curl tmux
#sudo apt install libsigc++-2.0-dev # C++ compiler
# 安装rTorrent和ruTorrent
# 可以安装二进制包,不支持ipv6
sudo apt-get install rtorrent;
# 也可自行编译安装支持IPv6的版本
cd ~/tmp
TODAY=`date +%Y-%m-%d`; TODAY=$(date +%Y-%m-%d);
mkdir -p $TODAY; cd $TODAY
# 原安装脚本
#wget https://raw.githubusercontent.com/lovewangbo/rTorrent/master/rtorrent_ipv6_v3.1
#chmod +x rtorrent_ipv6_*
#sudo ./rtorrent_ipv6_*
# 原安装脚本的精炼版
#curl -L http://sourceforge.net/projects/xmlrpc-c/files/Xmlrpc-c%20Super%20Stable/1.33.18/xmlrpc-c-1.33.18.tgz/download -o xmlrpc-c.tgz
wget xmlrpc-c.tgz https://sourceforge.net/projects/xmlrpc-c/files/Xmlrpc-c%20Super%20Stable/1.39.12/xmlrpc-c-1.39.12.tgz
tar zxvf xmlrpc-c*.tgz
cd xmlrpc*
./configure --disable-cplusplus
make clean && make -j$(nproc);
sudo make install
cd ..
sudo apt-get install build-essential pkg-config \
libssl-dev zlib1g-dev libncurses-dev libncursesw5-dev \
libcppunit-dev autoconf automake libtool
git clone https://github.com/rakshasa/libtorrent.git
cd libtorrent
./autogen.sh
./configure
make clean && make -j$(nproc);
sudo make install
cd ..
sudo apt-get install libncurses5-dev libcurl4-openssl-dev
git clone https://github.com/rakshasa/rtorrent.git
cd rtorrent/
./autogen.sh
./configure --with-xmlrpc-c --enable-ipv6
make clean && make -j$(nproc);
sudo make install
if [[ -z $(cat /etc/ld.so.conf | grep "/usr/local/lib/$") ]]; then
#echo -e "\ninclude /usr/local/lib/\n" >> /etc/ld.so.conf
sudo sed -i '$a\include \/usr\/local\/lib\/' /etc/ld.so.conf
fi
sudo ldconfig
ldd `whereis rtorrent | awk '{print $2}'`
#确定运行rt软件的账户
if [[ -z $BT_USER ]]; then
read -p "Add user account to run rtorrent/qbittorrent:" BT_USER
fi
if [[ -z $(cat /etc/passwd | grep "^$BT_USER:") ]]; then
sudo adduser $BT_USER
#sudo userdel $BT_USER
sudo usermod -s /bin/false $BT_USER
#sudo usermod -s /bin/bash $BT_USER
#或直接编辑/etc/passwd文件,将用户shell从false改成bash
fi
HOMEDIR=$(cat /etc/passwd | grep "$BT_USER": | cut -d: -f6)
RTORRENT_USER=$BT_USER
echo $HOMEDIR
cd $HOMEDIR;
sudo wget -O $HOMEDIR/.rtorrent.rc https://raw.githubusercontent.com/lovewangbo/rTorrent/master/.rtorrent.rc;
sudo chown "$RTORRENT_USER"."$RTORRENT_USER" $HOMEDIR/.rtorrent.rc;
sudo sed -i "s@HOMEDIRHERE@$HOMEDIR@g" $HOMEDIR/.rtorrent.rc;
sudo mkdir $HOMEDIR/.rtorrent-session;
sudo chown "$RTORRENT_USER"."$RTORRENT_USER" $HOMEDIR/.rtorrent-session;
sudo mkdir $HOMEDIR/Downloads;
sudo chown "$RTORRENT_USER"."$RTORRENT_USER" $HOMEDIR/Downloads;
sudo wget -O /etc/systemd/system/rtorrent.service https://raw.githubusercontent.com/lovewangbo/seedbox/master/templates/rtorrent.service
sudo sed -i "s@RT_USER_HERE@$RTORRENT_USER@g" /etc/systemd/system/rtorrent.service
sudo systemctl enable rtorrent
sudo systemctl status rtorrent
sudo systemctl start rtorrent
sudo systemctl status rtorrent
# 下面2行根据需要使用
sudo systemctl disable rtorrent
sudo systemctl stop rtorrent
systemctl list-unit-files | grep torrent
ps -ef | grep rtorrent
sudo apt-get install -y php php7.0-cli php7.0-json php7.0-curl php7.0-cgi php7.0-mbstring libapache2-mod-php libapache2-mod-scgi apache2;
sudo apt-get install -y unrar unzip ffmpeg mediainfo;
cd /var/www/html;
sudo git clone https://github.com/Novik/ruTorrent.git;
sudo chown -R $RTORRENT_USER:www-data ruTorrent/
sudo chmod -R 770 ruTorrent/;
echo -e "\n\n[httprpc]\nenabled = yes\n[rpc]\nenabled = no" | sudo tee -a /var/www/html/ruTorrent/conf/plugins.ini
echo -n "Input Web user id to log in:"
if [[ -z $rutorrent_user ]]; then
read -p "Add web user account to login in rtorrent/qbittorrent:" rutorrent_user;
fi
RUT_WEB_USER=$rutorrent_user;
sudo htpasswd -c /etc/apache2/.htpasswd $RUT_WEB_USER;
sudo sed -i '/^<\/VirtualHost>$/i\\n\t<Directory "/var/www/html/ruTorrent">\n\t\tAuthType Basic\n\t\tAuthName "Restricted Content"\n\t\tAuthUserFile /etc/apache2/.htpasswd\n\t\tRequire valid-user\n\t</Directory>\n' /etc/apache2/sites-enabled/000-default.conf
sudo service apache2 restart
# http://xxx.xxx.xxx.xxx/ruTorrent/
# 安装基于irssi的autodl-irssi插件
#参考资料
#https://github.com/autodl-community/autodl-rutorrent/wiki
# 安装SSH服务
sudo apt-get install openssh-server
# 安装系统必备工具
sudo apt install git tmux unzip
# 安装主程序
sudo apt install irssi
# 安装依赖php库【未经测试,可能不需要】
phpver=php7.0
for module in json xml sockets; do php -m| grep -wq $module || echo "Missing module: $module"; done
sudo apt install $phpver-xml $phpver-json
# enable php7.0-xml
sudo phpenmod xml json
# Restart php
sudo service apache2 restart
# 安装irssi的autodl-irssi插件所依赖的perl库
sudo apt install libxml-libxml-perl libjson-perl libarchive-zip-perl
# 若非全新安装,需要保证原进程完全停止
sudo kill -9 `ps -aux | grep irssi | awk '{print $2; exit}'`
# 确定rt用户目录
HOMEDIR=$(cat /etc/passwd | grep "$BT_USER": | cut -d: -f6)
RTORRENT_USER=$BT_USER
echo $HOMEDIR
# 备份重要配置文件,删除原程序文件
sudo mv $HOMEDIR/.autodl/autodl.cfg $HOMEDIR/.autodl/autodl.cfg.bak
sudo rm -rf $HOMEDIR/.irssi/scripts/AutodlIrssi $HOMEDIR/.irssi/scripts/autorun/autodl-irssi.pl
sudo rm -rf /var/www/html/ruTorrent/plugins/autodl-irssi
# 安装基于irssi自动启动脚本autodl-irssi
adlport=36000
adlpass=abcdefg
sudo mkdir -p $HOMEDIR/.irssi/scripts/autorun $HOMEDIR/.autodl
sudo wget -qO $HOMEDIR/autodl-irssi.zip $(curl -s https://api.github.com/repos/autodl-community/autodl-irssi/releases/latest | grep 'browser_' | cut -d\" -f4)
sudo unzip -qo $HOMEDIR/autodl-irssi.zip -d $HOMEDIR/.irssi/scripts/
sudo mv $HOMEDIR/.irssi/scripts/autodl-irssi.pl $HOMEDIR/.irssi/scripts/autorun/
sudo rm -f $HOMEDIR/autodl-irssi.zip
# 安装autodl-rutorrent
# 方法一
cd /var/www/html/ruTorrent/plugins/
sudo git clone https://github.com/autodl-community/autodl-rutorrent.git autodl-irssi
sudo chown -R www-data:www-data autodl-irssi
# # 方法二
wget -qO $HOMEDIR/autodl-rutorrent.zip https://github.com/autodl-community/autodl-rutorrent/archive/master.zip
unzip -qo $HOMEDIR/autodl-rutorrent.zip
mv $HOMEDIR/autodl-rutorrent-master /var/www/html/ruTorrent/plugins/autodl-irssi
rm $HOMEDIR/autodl-rutorrent.zip
sudo wget -qO $HOMEDIR/.autodl/autodl.cfg https://raw.githubusercontent.com/lonecrane/seedbox/master/conf/autodl.cfg
sudo sed -i '/gui-server-port\ =\ /c\gui-server-port = '"$adlport"'' $HOMEDIR/.autodl/autodl.cfg
sudo sed -i '/gui-server-password\ =\ /c\gui-server-password = '"$adlpass"'' $HOMEDIR/.autodl/autodl.cfg
sudo mv /var/www/html/ruTorrent/plugins/autodl-irssi/_conf.php /var/www/html/ruTorrent/plugins/autodl-irssi/conf.php
sudo sed -i '/\$autodlPort\ =\ /c\\$autodlPort = '"$adlport"';' /var/www/html/ruTorrent/plugins/autodl-irssi/conf.php
sudo sed -i '/\$autodlPassword\ =\ /c\\$autodlPassword = '"$adlpass"';' /var/www/html/ruTorrent/plugins/autodl-irssi/conf.php
# set permissions
sudo chown -R www-data:www-data /var/www/html/ruTorrent
sudo chmod -R 755 /var/www/html/ruTorrent
sudo chown -R $BT_USER:$BT_USER $HOMEDIR
# Restart irssi
sudo kill -9 `ps -aux | grep irssi | awk '{print $2; exit}'`
ps -aux | grep irssi
sudo su - $BT_USER -c 'tmux -2 new-session -d -s autodl irssi'
# If necessary, go to look the interface of irssi
su $BT_USER
tmux attach -t autodl
tmux kill-session -t autodl
# 安装qBittorrent
sudo apt-get install -y build-essential pkg-config automake libtool git zlib1g-dev python3
sudo apt-get install -y libboost-dev libboost-system-dev libboost-chrono-dev libboost-random-dev libssl-dev
sudo apt-get install -y qtbase5-dev qttools5-dev-tools libqt5svg5-dev
####libtorrent安装开始
#以下二选一
####安装二进制包,若为v1.0.7则非C++11编译,经测试不兼容qb v4.0.3(编译时报命名空间错误),但可与qb v3.3.14兼容
sudo apt-get install -y libtorrent-rasterbar-dev
####编译#安装指定版本
cd ~/tmp
TODAY=`date +%Y-%m-%d`; TODAY=$(date +%Y-%m-%d);
mkdir -p $TODAY; cd $TODAY
git clone https://github.com/arvidn/libtorrent.git
cd libtorrent
# 默认安装1.2.0,qb最新版4.2.0尚不支持 2018/6/19
# 较老版本的qb,如v3.3.x与libtorrent 1.1.x存在兼容性问题,需要安装1.0.x版本
# git checkout $(git tag | grep libtorrent-1_0_ | sort -t _ -n -k 3 | tail -n 1)
# 若apt-get autoremove过,可能被清理掉而缺少Geoip库,具体情形未知
# sudo apt-get install libgeoip-dev
# 较新版本的qb,与新版libtorrent兼容,但性能存在问题。另外已知v4.0.4与mt的IPV6 tracker存在兼容问题:Address family not supported by protocol "" (3)
git checkout $(git tag | grep libtorrent-1_1_ | sort -t _ -n -k 3 | tail -n 1)
./autotool.sh
./configure -disable-debug --enable-encryption --with-libgeoip=system CXXFLAGS=-std=c++11
# 如需安装到用户:
# ./configure -disable-debug --enable-encryption --with-libgeoip=system CXXFLAGS=-std=c++11 --prefix=$HOME/.local
make clean && make -j$(nproc);
#checkinstall
sudo make install
if [[ -z $(cat /etc/ld.so.conf | grep "/usr/local/lib/$") ]]; then
#echo -e "\ninclude /usr/local/lib/\n" >> /etc/ld.so.conf
sudo sed -i '$a\include \/usr\/local\/lib\/' /etc/ld.so.conf
fi
sudo ldconfig
#########
# 用automake工具编译安装的用以下命令可查到:
pkg-config --list-all | grep libtorrent-rasterbar
# 用apt-get install命令安装的还可用以下命令可查到,可以用dpkg -P卸载:
dpkg -l | grep libtorrent-rasterbar
####libtorrent安装完毕。
#似乎只涉及删除一个库文件即可:
/bin/bash ../libtool --mode=uninstall rm -f '/usr/local/lib/libtorrent-rasterbar.la'
libtool: uninstall: rm -f /usr/local/lib/libtorrent-rasterbar.la /usr/local/lib/libtorrent-rasterbar.so.9.0.0 /usr/local/lib/libtorrent-rasterbar.so.9 /usr/local/lib/libtorrent-rasterbar.so /usr/local/lib/libtorrent-rasterbar.a
##
cd ..
TODAY=`date +%Y-%m-%d`; TODAY=$(date +%Y-%m-%d);
mkdir -p ~/tmp/$TODAY; cd ~/tmp/$TODAY
git clone https://github.com/qbittorrent/qBittorrent
cd qBittorrent;
#以下3选1
#########
# 最新版4.1.1各大站全支持 2018/6/19
# 默认安装的是4.2.0alpha,需要手动指定版本
# git checkout release-4.1.2
git checkout $(git tag | grep release- | sort -t _ -n -k 3 | tail -n 1)
#########
# 3.3.11原版本不能跳过校验,需merge若干commits
git checkout release-3.3.11
# 增加快速发种选项
git cherry-pick db3158c
git cherry-pick b271fa9
# 显示磁盘IO状态
git cherry-pick 1ce71fc
#########
# 3.3.14 mt和hdsky不支持
#wget https://sourceforge.net/projects/qbittorrent/files/qbittorrent/qbittorrent-3.3.14/qbittorrent-3.3.14.tar.gz
#tar -xvzf qbittorrent-*.tar.gz; cd qbittorrent-*;
# 3.3.14修改后可在各站通用
CHOOSED_QB="3.3.14";
#先放弃所有本地修改
git checkout .
git checkout release-$CHOOSED_QB
sed -i '/CFBundleShortVersionString/,/<\/string>/{s/'"$CHOOSED_QB"'/3.3.11/p}' dist/mac/Info.plist
sed -i 's@!define PROG_VERSION "[0-9].[0-9].[0-9]\+"@!define PROG_VERSION "3.3.11"@' dist/windows/options.nsi
sed -i 's@VER_MAJOR = [0-9]@VER_MAJOR = 3@' version.pri
sed -i 's@VER_MINOR = [0-9]@VER_MINOR = 3@' version.pri
sed -i 's@VER_BUGFIX = [0-9]\+@VER_BUGFIX = 11@' version.pri
sed -i 's@USER_AGENT\[\] = "qBittorrent\/"@USER_AGENT\[\] = "qBittorrent v"@' src/base/bittorrent/session.cpp
cat dist/mac/Info.plist | grep 3.3.11
cat dist/windows/options.nsi | grep 3.3.11
cat version.pri | grep 'VER_MAJOR =\|VER_MINOR =\|VER_BUGFIX ='
cat src/base/bittorrent/session.cpp | grep "qBittorrent v"
#########
./configure --disable-gui;
# 如需安装到用户目录:
# ./configure --disable-gui; --prefix=$HOME/.local
make clean && make -j$(nproc);
sudo make install;
#sudo checkinstall;
ldd `whereis qbittorrent-nox | awk '{print $2}'`
cd ..
#确定运行qb软件的账户
if [[ -z $BT_USER ]]; then
read -p "Add user account to run rtorrent/qbittorrent:" BT_USER
fi
if [[ -z $(cat /etc/passwd | grep "^$BT_USER:") ]]; then
sudo adduser $BT_USER
#sudo userdel $BT_USER
fi
#sudo usermod -s /bin/false $BT_USER
#sudo usermod -s /bin/bash $BT_USER
#或直接编辑/etc/passwd文件,将用户shell从false改成bash
HOMEDIR=$(cat /etc/passwd | grep "$BT_USER": | cut -d: -f6)
echo $HOMEDIR
echo -e "web_port Web_user Web_passwd"
echo -e "8080 admin adminadmin"
QB_WEB_PORT=
QB_WEB_USER=
QB_WEB_PASSWD=
QB_WEB_PORT=1234
QB_WEB_USER=xxxx
QB_WEB_PASSWD=xxxxxxx
if [[ -z $QB_WEB_PORT ]]; then
read QB_WEB_PORT
fi
if [[ -z $QB_WEB_USER ]]; then
read QB_WEB_USER
fi
if [[ -z $QB_WEB_PASSWD ]]; then
read QB_WEB_PASSWD
fi
# 配置文件
# (1) 3.x可用
QB_WEB_PASSWD_HASH=`echo -n $QB_WEB_PASSWD | md5sum | awk '{print $1}'`;
#sudo wget -qO $HOMEDIR/.config/qBittorrent/qBittorrent.conf https://raw.githubusercontent.com/lovewangbo/qbittorrent/master/qBittorrent.conf
sudo wget -qO qBittorrent.conf https://raw.githubusercontent.com/lovewangbo/seedbox/master/conf/qBittorrent.conf
sudo sed -i 's@\(Downloads\\SavePath=\)\/home\/QBUSERHERE@\1'"$HOMEDIR"'@g' qBittorrent.conf
#sudo sed -i 's@\(WebUI\\Port=\)8080@\1'"$QB_WEB_PORT"'@g' qBittorrent.conf
sudo sed -i 's@\(WebUI\\Username=\)admin@\1'"$QB_WEB_USER"'@g' qBittorrent.conf
sudo sed -i 's/\(WebUI\\Password_ha1=@ByteArray(\)f6fdffe48c908deb0f4c3bd36c032e72/\1'"$QB_WEB_PASSWD_HASH"'/g' qBittorrent.conf
sudo mkdir -p $HOMEDIR/.config/qBittorrent/
sudo mv qBittorrent.conf $HOMEDIR/.config/qBittorrent/qBittorrent.conf
sudo chown -R "$BT_USER"."$BT_USER" $HOMEDIR/.config/
# (2) 4.x用上面的会导致tracker不能解析等问题
# 4.1.2默认连不上web-ui,需要加上以下语句;4.1.5中无此问题
WebUI\Address=*
WebUI\ServerDomains=*
QB_PATH_NAME=`whereis qbittorrent-nox | awk '{print $2}'`
#QB_PATH_NAME=$(whereis qbittorrent-nox | awk '{print $2}') #也可
wget -qO qbittorrent.service https://raw.githubusercontent.com/lovewangbo/seedbox/master/templates/qbittorrent.service
sed -i 's@{{QB_USER}}@'"$BT_USER"'@g' qbittorrent.service;
sed -i 's@{{QB_PATH_NAME}}@'"$QB_PATH_NAME"'@g' qbittorrent.service;
sed -i 's@{{QB_WEB_PORT}}@'"$QB_WEB_PORT"'@g' qbittorrent.service;
sudo mv qbittorrent.service /etc/systemd/system/qbittorrent.service;
sudo systemctl enable qbittorrent
systemctl status qbittorrent
sudo systemctl start qbittorrent
systemctl status qbittorrent
# sudo systemctl stop qbittorrent
# sudo systemctl disable qbittorrent
systemctl list-unit-files | grep torrent
#my_server_ip=127.0.0.1
#my_server_port=
#mypassword=
# 修改最大打开文件数
# 默认值为1024
ulimit -a
ulimit -n 65535
# 注意同一session中,若用该命令改过该限值一次以后就只能往下改。如果需要往上修改,需要重新登录。
# 安装Shadowsocks
# 以下为安装到root账号。如需安装到非root账号,要去掉和shadowsocks、libsodium相关的sudo,并在.service文件中指定运行用户
echo "Now install shadowsocks:"
echo "Your python version is:"
python --version
# python 2.x
sudo apt-get install -y python-gevent python-pip;
sudo pip install shadowsocks;
sudo apt-get install -y python-m2crypto;
# python 3.x
# sudo pip3 install shadowsocks # 安装的仍是2.x版本
# # 升级至3.x版。2.x版不支持等加密方式
sudo pip install https://github.com/shadowsocks/shadowsocks/archive/master.zip -U
sudo apt install libssl-dev swig
# pip3 install M2Crypto
# 提示load libsodium failed with path None时需要安装libsodium
wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
tar xf LATEST.tar.gz && cd libsodium*
./configure && make -j$(nproc)
sudo make install
sudo ldconfig
echo -e "server_port passwd:"
if [[ -z $my_server_port ]]; then
read my_server_port
fi
if [[ -z $my_server_passwd ]]; then
read my_server_passwd
fi
echo -e "8080 adminadmin"
wget -qO shadowsocks_config.json https://raw.githubusercontent.com/lovewangbo/seedbox/master/templates/shadowsocks/config.json
sed -i "s@my_server_port@${my_server_port}@g" shadowsocks_config.json
# 若passwd含有@之类的特殊字符,可能导致替换失败,需要手动确认
sed -i "s@mypassword@${my_server_passwd}@g" shadowsocks_config.json
sudo mkdir -p /etc/shadowsocks;
sudo mv shadowsocks_config.json /etc/shadowsocks/config.json
sudo wget -O /etc/systemd/system/shadowsocks.service https://raw.githubusercontent.com/lovewangbo/seedbox/master/templates/shadowsocks/shadowsocks.service
# 由于升级 openssl 至1.1.0以上版本导致的 shadowsocks 服务出现 undefined symbol: EVP_CIPHER_CTX_cleanup 错误而无法启动的问题
# 这是由于在openssl 1.1.0中废弃了 EVP_CIPHER_CTX_cleanup() 函数而引入了 EVE_CIPHER_CTX_reset() 函数
# 此时需要根据出错提示将文件名的函数恢复为原名称
# python 2.x
sed -i "s@EVP_CIPHER_CTX_cleanup@EVP_CIPHER_CTX_reset@g" /usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py
# python 3.x
sed -i "s@EVP_CIPHER_CTX_cleanup@EVP_CIPHER_CTX_reset@g" /usr/local/lib/python3.6/dist-packages/shadowsocks/crypto/openssl.py
# 2020.07.21成功安装,更新:
# 在debian 10上仅作如下操作便成功:
sudo pip install https://github.com/shadowsocks/shadowsocks/archive/master.zip -U
# 注意本次未使用pip3,未测试可行性
sudo apt install libssl-dev swig
my_server_port=xxxxx
my_server_passwd=xxxxx
wget -qO shadowsocks_config.json https://raw.githubusercontent.com/lovewangbo/seedbox/master/templates/shadowsocks/config.json
52 sed -i "s@my_server_port@${my_server_port}@g" shadowsocks_config.json
53 # 若passwd含有@之类的特殊字符,可能导致替换失败,需要手动确认
54 sed -i "s@mypassword@${my_server_passwd}@g" shadowsocks_config.json
55 sudo mkdir -p /etc/shadowsocks;
56 sudo mv shadowsocks_config.json /etc/shadowsocks/config.json
57 nano /etc/shadowsocks/config.json
58 sudo wget -O /etc/systemd/system/shadowsocks.service https://raw.githubusercontent.com/lovewangbo/seedbox/master/templates/shadowsocks/shadowsocks.service
sudo systemctl enable shadowsocks;
sudo systemctl start shadowsocks;
sudo systemctl status shadowsocks;
# 如果出现问题,可运行
# 安装frp反向代理
wget -q https://github.com/fatedier/frp/releases/download/v0.33.0/frp_0.33.0_linux_amd64.tar.gz
tar -zxvf frp_*.tar.gz
# 测试运行一下,看结果是否正常
# cd frp_0.33.0_linux_amd64
# ./frps -c ./frps.ini
# cd ..
mv frp_0.33.0_linux_amd64 /usr/local/bin/
# 终极测试命令
# /usr/local/bin/frp_0.33.0_linux_amd64/frps -c /usr/local/bin/frp_0.33.0_linux_amd64/frps.ini
wget -q https://raw.githubusercontent.com/lonecrane/seedbox/master/templates/frp.service
systemctl enable frp.service
systemctl start frp.service
systemctl status frp.service
# 安装flexget
# sudo apt install python3-pip
# 非root用户只能安装到自己的用户目录,所以不能跨用户使用
# pip3 install --user flexget
# root用户安装可以全局调用
sudo pip install flexget
#确定运行软件的账户
if [[ -z $BT_USER ]]; then
read -p "Add user account to run rtorrent/qbittorrent:" BT_USER
fi
HOMEDIR=$(cat /etc/passwd | grep "$BT_USER": | cut -d: -f6)
sudo mkdir $HOMEDIR/.flexget
sudo wget -qO conf.yml https://raw.githubusercontent.com/lonecrane/seedbox/master/flexget/config.yml
# 编辑文件,修改qb web ui的用户名、密码【如重试次数太多会被ban ip,需要重启qb】
sudo nano conf.yml
sudo mv conf.yml $HOMEDIR/.flexget/config.yml
sudo chown -R $BT_USER:$BT_USER $HOMEDIR/.flexget
# 密码为Love321654@
sudo su - $BT_USER -c "flexget web passwd Love321654@"
# 调试
# 多次安装过程都需要登录帐户实地测试和运行
sudo usermod -s /bin/bash $BT_USER
su $BT_USER
# 仅测试配置文件是否正确:
flexget --test --loglevel debug execute
# 单独测试一个task
flexget execute --task chdbits_test
# 显示详细情况以诊断
flexget execute --task chdbits_test --dump
# 将老种标记为已下载
flexget execute --learn
# 无需sudo权限运行(方便测试):
flexget daemon start -d
# 修改配置后重新加载
flexget daemon reload-config
# !2019-12-03在Ubuntu 18.04上安装,WEB-UI登录页面无法正常显示。
sudo wget -qO flexget.service https://raw.githubusercontent.com/lonecrane/seedbox/master/flexget/flexget.service
sudo sed -i 's@{{BT_USER}}@'"$BT_USER"'@g' flexget.service;
sudo mv flexget.service /etc/systemd/system/
sudo systemctl enable flexget
sudo systemctl start flexget
sudo systemctl status flexget
# sudo systemctl stop flexget
# 限速
su #必须以root运行方正常工作
DEFAULT_INTERFACE=`ip route get 8.8.8.8 | awk '{print $5; exit}'` #获取网卡名称
tc qdisc add dev $DEFAULT_INTERFACE root tbf rate 450mbit latency 70ms burst 10kb # 正确的写法
#tc qdisc add dev $DEFAULT_INTERFACE root tbf rate 500mbit latency 50ms burst 1000 # 错误的写法
tc qdisc show dev $DEFAULT_INTERFACE
# 视需要选用
tc qdisc del dev $DEFAULT_INTERFACE root
# 流量统计
sudo apt-get install vnstat
## 配置
### 暂停服务
sudo systemctl stop vnstat
sudo systemctl status vnstat
### 创建数据库
DEFAULT_INTERFACE=`ip route get 8.8.8.8 | awk '{print $5; exit}'` #获取网卡名称
#### 部分机器格式不同,如woothosting
#### DEFAULT_INTERFACE=`ip route get 8.8.8.8 | awk '{print $5; exit}'` #获取网卡名称
sudo vnstat -u -i $DEFAULT_INTERFACE
### 检查文件夹权限
ls -al /var/lib/vnstat
sudo chown -R vnstat:vnstat /var/lib/vnstat
### 改为默认网卡名:
#### sudo nano /etc/vnstat.conf
#### Interface "eno1"
#sudo sed -i "s@Interface \".\+\"@Interface \"${DEFAULT_INTERFACE}\"@g" /etc/vnstat.conf
sudo sed -i "s@Interface \".*\"@Interface \"${DEFAULT_INTERFACE}\"@g" /etc/vnstat.conf
### 启动服务
sudo systemctl start vnstat
sudo systemctl status vnstat
vnstat -i $DEFAULT_INTERFACE -l #实时流量情况
vnstat -i $DEFAULT_INTERFACE -h #按小时查询流量情况
vnstat -i $DEFAULT_INTERFACE -d #按天数查询流量情况
vnstat -i $DEFAULT_INTERFACE -m #按月数查询流量情况
vnstat -i $DEFAULT_INTERFACE -w #按周数查询流量情况
vnstat -i $DEFAULT_INTERFACE -t #查询TOP10流量情况
### 如已配置默认网卡,也可省略网卡名称
# 安装FTP
sudo apt install vsftpd
# 配置
sudo systemctl stop vsftpd
## 启用上传功能
grep -n 'write_enable' /etc/vsftpd.conf # 得到行号
sudo nano /etc/vsftpd.conf
# 取消注释write=yes
## 更改默认端口,增强安全性
# 在文件末尾添加一行:
listen_port=8021
sudo nano /etc/services
# 找到ftp选项并将21修改成你设置的端口,本例为8021
grep -n "ftp" /etc/services
# 修改:
ftp 8021/tcp
ftp 8021/udp
## 重启服务
sudo systemctl start vsftpd
sudo systemctl status vsftpd
# FTP取回本地速度很慢,用HTTP服务器
sudo apt-get install apache2
# 更改默认端口号80为其他值如8021
sudo nano /etc/apache2/ports.conf
# 相应修改
sudo nano /etc/apache2/sites-available/000-default.conf
# 重启服务生效
sudo systemctl restart apache2
# 将含有待取回文件的目录链接到APACHE主目录下
USER=xxx
sudo ln -s /home/$USER/Downloads /var/www/html/Downloads
#如有需要,获取网卡名称和IP地址
echo -n "Your possible Ethernet: "
DEFAULT_INTERFACE=`ip route get 8.8.8.8 | awk '{print $5; exit}'` #获取网卡名称
# ifconfig | grep "Link encap" | awk '{print $1}' # 也可
# read -e DEFAULT_INTERFACE
#ifconfig | grep inet | cut -d : -f 2 | cut -d " " -f 1 # 获取ip地址
#curl -s checkip.dyndns.com | cut -d' ' -f 6 | cut -d'<' -f 1 #也可
#echo -n "Input the proper IP address: "
#read -e my_server_ip
my_server_ip=$(ifconfig $DEFAULT_INTERFACE | grep inet | cut -d : -f 2 | cut -d " " -f 1)
echo -n "Check your IP address : "
echo $my_server_ip
# 安装deluge
# (1) 原编译方式:
# 先安装各种依赖
sudo apt-get install python python-twisted python-openssl python-setuptools intltool python-xdg python-chardet geoip-database python-libtorrent python-notify python-pygame python-glade2 librsvg2-common xdg-utils python-mako
# 再安装libtorrent-rasterbar,如安装qb时已安装则可跳过
# 开始安装主程序
# 可跳过校验版
wget -q https://github.com/lonecrane/BitTorrentClientCollection/raw/master/Deluge/deluge-1.3.15.skip.tar.gz
# 原版
wget -q http://download.deluge-torrent.org/source/deluge-1.3.15.tar.gz
# 开始编译和安装
# 此处注意多个安装包的重名问题
tar -xvzf deluge-*.tar.gz;
cd deluge-*;
python setup.py clean -a
python setup.py build
sudo python setup.py install
# (2)最新方式
sudo apt-get install deluged deluge-web deluge-console deluge-client
# deluge-client可使flexget通过RPC方式自动加种
# 配置
# # 允许rpc:Preferences->Daemon->Allow Remote Connections
# # 自动启动
BT_USER=xxx
wget -qO deluged.service https://raw.githubusercontent.com/lonecrane/seedbox/master/deluge/deluged.service
wget -qO deluge-web.service https://raw.githubusercontent.com/lonecrane/seedbox/master/deluge/deluge-web.service
sed -i 's@{{QB_USER}}@'"$BT_USER"'@g' deluged.service
sed -i 's@{{QB_USER}}@'"$BT_USER"'@g' deluge-web.service
# cat deluged.service
# cat deluge-web.service
sudo mv deluged.service /etc/systemd/system/deluged.service;
sudo mv deluge-web.service /etc/systemd/system/deluge-web.service;
sudo systemctl enable deluged
sudo systemctl start deluged
systemctl status deluged
# sudo systemctl stop deluged
# sudo systemctl disable deluged
sudo systemctl enable deluge-web
sudo systemctl start deluge-web
systemctl status deluge-web
# sudo systemctl stop deluge-web
# sudo systemctl disable deluge-web
systemctl list-unit-files | grep deluge
# 安装ltconfig插件,在Preferences中加载egg文件,注意默认python版本必须为python2
# # 在ltconfig中选择模式为High Performance并Load preset
# # 并修改active_tracker_limit。如果做种3K个,就至少需要将这个值设置为3K
#!/bin/bash
# torrentid=$1
# torrentname=$2
# torrentpath=$3
# deluge的自动运行插件
wget https://raw.githubusercontent.com/lonecrane/seedbox/master/feralhosting/auto_exec_for_deluge.sh
#再在对话框中填入脚本运行地址即可:
/media/md3/yellow/auto_exec_for_deluge.sh
# 自动重新开始卡壳的种子,对ipt和tl等autodl-irssi dealy时间不确定的站有用
wget https://raw.githubusercontent.com/lonecrane/seedbox/master/feralhosting/auto_restart_torrent.sh
# SSH同步文件夹
rsync -avL -e 'ssh -p 22' --progress [email protected]:/home/jack/Downloads/Decode_done From10o/
# 注意:
# -p指定端口号,如不指定,默认使用22
# IP与远程路径间的“:”号必需
# 远程路径与本地路径末尾视需要加上"/",加上指示子文件夹,不加指示文件夹本身。
# 给账户增加和移除ssh权限(woothosting默认只有root登录)
## 以待增加ssh权限的用户运行,生成ssh相关配置文件【未确定是否必需】
ssh-keygen -t rsa
## 修改ssh总配置
sudo nano /etc/ssh/sshd_config
### 附加一行开户白名单功能,仅允许用户xxxx通过ssh登录
AllowUsers xxxx
### 增加这一行以后root便不能ssh登录
## 重启ssh服务
systemctl restart sshd