日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux解压torrent文件命令,linux版uTorrent安装手记

發布時間:2024/3/26 linux 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux解压torrent文件命令,linux版uTorrent安装手记 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

PT資源需要用uTorrent來下載,而原來uTorrent只有windows版本。我的NAS下載機安裝的是linux系統,沒有相應版本 的uTorrent可以使用,讓人比較糾結。網上也有介紹使用wine在linux下運行windows版的uTorrent,總之不是太爽。原生的 linux版uTorrent終于在2010年9月發布,到現在3個多月過去了,雖然還是Alpha版而非正式版,應該也比較成熟了,因此決定嘗試安裝使 用。

一、安裝環境

先說說我的NAS機器,這個東東的DIY過程已經在本版發帖做過介紹。主要是用ATOM330CPU的離子主板配的下載機。操作系統是ubuntu9.10server版,裝了mldonkey下載資源,裝了XBMC來播放。

二、uTorrent安裝

到uTorrent的主頁下載最新的linux版壓縮包:http://www.utorrent.com/downloads/linux

我下載回來的uTorrent Server alpha (3.0 build 23418)文件是utorrent-server-3.0-23418.tar.gz

在linux系統中解壓:

tar zxvf utorrent-server-3.0-23418.tar.gz

解壓出一個目錄utorrent-server-v3_0可以看到目錄結構:

utorrent-server-v3_0 ---+--- docs (文檔資料目錄)

+--- utserver(主程序)

+--- webui.zip(web界面系統)

這個東西說起來也簡單,直接運行utserver就行,當然,運行前還得創建一個配置文件utserver.conf,最好還是編寫一個腳本來方便地啟動和停止utserver服務。uTorrent的linux版還不是正式版本,安裝工作自己還得多動點手。

(一)初級班

對于入門級用戶,首先能用起來可能就滿足了。適合這個簡單的初級班教程。

1. 用wget命令下載安裝包

wget http://download.utorrent.com/linux/utorrent-server-3.0-23418.tar.gz

(注意:具體安裝包文件名可能會變化)

2. 用ls命令看看是否成功下載

ls

3. 如果下載成功,就用tar命令解壓安裝包

tar zxvf utorrent-server-3.0-23418.tar.gz

(如前所述,壓縮包文件名也許與我這個不同)

4. 進入解壓出來的目錄

ls

cd utorrent-server-v3_0

5. 運行uTorrent Server的主程序

./utserver

6. 在瀏覽器中連接uTorrent Server的web控制頁面,默認登錄用戶admin,密碼為空

http://localhost:8080/gui/

(這里是從本機訪問,當然也可以從其它電腦訪問,把localhost改成uTorrent Server所在電腦IP就可)

復制代碼

初級班課程到此結束。

(二)高級班

作為高級班的同學,咱們當然得仔細研究下布局了。我考慮照通常軟件安裝的目錄來辦,執行主程序放到/usr/bin目錄,配置文件、運行記錄log文件等都放到/var/lib/utorrent目錄,主要文件分布如下:

/usr/bin/utserver(主程序)

/etc/init.d/utserver(啟動腳本)

/var/lib/utorrent/utserver.conf(配置文件)

/var/lib/utorrent/utserver.log(運行記錄)

/var/lib/utorrent/webui.zip(web界面文件)

復制代碼

而且為了方便自己管理下載回來的資源,決定讓utserver進程以我的個人用戶權限運行,對我來說就是用戶為taxigps,組也為taxigps。當然你也可以專門為運行utorrent創建一個用戶。創建用戶的問題在這里就不細表了。

1. 咱們先創建utserver的工作目錄

sudo mkdir /var/lib/utorrent

sudo chown taxigps /var/lib/utorrent

sudo chgrp taxigps /var/lib/utorrent

sudo mkdir /var/run/utserver

sudo chown taxigps /var/run/utserver

sudo chgrp taxigps /var/run/utserver

(這里的用戶名和組名可別抄我的)

2. 把相關文件拷貝到指定目錄

sudo cp utserver /usr/bin

cp webui.zip /var/lib/utorrent

復制代碼

下面一項重要工作就是創建啟動腳本了,用這個命令:

sudo nano /etc/init.d/utserver

復制代碼

腳本內容如下:

#! /bin/sh

### BEGIN INIT INFO

# Provides: utserver

# Required-Start: $local_fs $remote_fs $network

# Required-Stop: $local_fs $remote_fs $network

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: Start or stop the utserver.

# Description: uTorrent Server for Linux. A headless

# bittorrent client with a WebUI.

### END INIT INFO

# Author: John Doe john.doe@jd.com

# Please remove the "Author" lines above and replace them

# with your own name f you copy and modify this script.

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script

PATH=/sbin:/usr/sbin:/bin:/usr/bin

DESC="uTorrent Server for Linux"

CHDIR=/usr/bin

NAME=utserver

UT_CONFIG=/var/lib/utorrent/$NAME.conf

UT_SETTINGS=/var/lib/utorrent/

UT_LOG=/var/lib/utorrent/$NAME.log

#DAEMON_ARGS="-daemon -configfile ${UT_CONFIG} -settingspath ${UT_SETTINGS} -logfile ${UT_LOG}"

DAEMON_ARGS="-configfile ${UT_CONFIG} -settingspath ${UT_SETTINGS} -logfile ${UT_LOG}"

DAEMON=$CHDIR/$NAME

USER=taxigps

GROUP=taxigps

PIDFILE=/var/run/$NAME/$NAME.pid

SCRIPTNAME=/etc/init.d/$NAME

STOP_TIMEOUT=5

INIT_VERBOSE=yes

# Exit if the package is not installed

[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present

[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables

. /lib/init/vars.sh

# Define LSB log_* functions.

# ##!u

. /lib/lsb/init-functions

# Function that starts the daemon/service

do_start()

{

# Return

# 0 if daemon has been started

# 1 if daemon was already running

# 2 if daemon could not be started

start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE --chuid $USER:$GROUP --chdir $CHDIR --background --exec $DAEMON --test > /dev/null \

|| return 1

start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE --chuid $USER:$GROUP --chdir $CHDIR --background --exec $DAEMON -- \

$DAEMON_ARGS \

|| return 2

# Add code here, if necessary, that waits for the process to be ready

# to hand./le requests from services started subsequently which depend

# on this one. As a last resort, sleep for some time.

}

# Function that stops the daemon/service

do_stop()

{

# Return

# 0 if daemon has been stopped

# 1 if daemon was already stopped

# 2 if daemon could not be stopped

# other if a failure occurred

start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME

RETVAL="$?"

[ "$RETVAL" = 2 ] && return 2

# Wait for children to finish too if this is a daemon that forks

# and if the daemon is only ever run from this initscript.

# If the above conditions are not satisfied then add some other code

# that waits for the process to drop all resources that could be

# needed by services started subsequently. A last resort is to

# sleep for some time.

start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON

[ "$?" = 2 ] && return 2

# Many daemons don't delete their pidfiles when they exit.

rm -f $PIDFILE

return "$RETVAL"

}

# Function that sends a SIGHUP to the daemon/service

do_reload() {

# If the daemon can reload its configuration without

# restarting (for example, when it is sent a SIGHUP),

# then implement that here.

start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME

return 0

}

case "$1" in

start)

[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"

do_start

case "$?" in

0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;

2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;

esac

;;

stop)

[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"

do_stop

case "$?" in

0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;

2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;

esac

;;

status)

status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?

;;

#reload|force-reload)

# If do_reload() is not implemented then leave this commented out

# and leave 'force-reload' as an alias for 'restart'.

#log_daemon_msg "Reloading $DESC" "$NAME"

#do_reload

#log_end_msg $?

#;;

restart|force-reload)

# If the "reload" option is implemented then remove the

# 'force-reload' alias

log_daemon_msg "Restarting $DESC" "$NAME"

do_stop

case "$?" in

0|1)

do_start

case "$?" in

0) log_end_msg 0 ;;

log_end_msg 1 ;; # Old process is still running

*) log_end_msg 1 ;; # Failed to start

esac

;;

*)

# Failed to stop

log_end_msg 1

;;

esac

;;

*)

#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2

echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2

exit 3

;;

esac

:

復制代碼

腳本中這幾行代碼請根據你自己的情況修改:

CHDIR=/usr/bin

UT_CONFIG=/var/lib/utorrent/$NAME.conf

UT_SETTINGS=/var/lib/utorrent/

UT_LOG=/var/lib/utorrent/$NAME.log

USER=taxigps

GROUP=taxigps

PIDFILE=/var/run/$NAME/$NAME.pid

復制代碼

啟動腳本創建完成后還要設置成可執行代碼:

sudo chmod a+x /etc/init.d/utserver

復制代碼

現在你可以用腳本命令來啟動和停止utorrent服務了:

/etc/init.d/utserver start(啟動utorrent)

/etc/init.d/utserver stop(停止utorrent)

復制代碼

現在用起來更方便了吧。

(三)尖子班

尖子班的同學還有更高的追求,比如我就想把720P的電影和1080P的電影下載存放到不同的目錄。讓我們先建兩個目錄吧:

mkdir /mnt/data/utorrent

mkdir /mnt/data/share/電影/720P

mkdir /mnt/data/share/電影/1080P

復制代碼

注 意,你工作目錄,存放下載過程中的臨時文件,下載完成 后再移動到完成目錄,要保證臨時目錄和完成目錄在同一硬盤,避免大量的文件拷貝。

下一個重要步驟就是編輯utorrent的配置文件了,還是用nano命令:

nano /var/lib/utorrent/utserver.conf

復制代碼

參考配置文件內容如下:

# web界面端口號

ut_webui_port:8080

# token認證

token_auth_enable:1

# 保存正在下載項目的臨時文件目錄

dir_active:/mnt/data/utorrent

# 保存完成下載項目的默認目錄

dir_completed:/mnt/data/share/電影/720P

# 保存完成下載項目的可選目錄(可以是多個)

dir_download:/mnt/data/share/電影/720P

dir_download:/mnt/data/share/電影/1080P

# web界面登錄用戶名

admin_name:admin

# web界面登錄密碼

admin_password:test

復制代碼

最后,要在web界面使用分目錄存放下載文件功能,你需要下載最新的webui界面系統。到此下載:http://forum.utorrent.com/viewtopic.php?id=58156

總結

以上是生活随笔為你收集整理的Linux解压torrent文件命令,linux版uTorrent安装手记的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。