Help - Search - Members - Calendar
Full Version: How To Create And Upload A Torrent Using Only Command Line Tools In Linux
Darkside_RG > Technical Discussions > Guides/How To > Torrents
syn-ack
How to create and upload a torrent using only command line tools in Linux



Prerequisites
libtorrent, rtorrent and ctorrent installed.


Download and Install

CODE
wget http://www.rahul.net/dholmes/ctorrent/ctorrent-dnh3.1.tar.gz
wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.7.4.tar.gz
wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.11.4.tar.gz


CODE
tar xvzf ctorrent-dnh3.1.tar.gz
cd ctorrent-dnh3.1
./configure
sudo make install; ldconfig; cd ../


CODE
tar xvzf libtorrent-0.11.4.tar.gz
cd libtorrent-0.11.4
./configure
make
sudo make install; ldconfig; cd ../


CODE
tar xzvf rtorrent-0.7.4.tar.gz
cd rtorrent-0.7.4
./configure
make
sudo make install; ldconfig




I have used the example file from the wiki as a base, This will
1) Save Torrents in "~/Torrents"
2) Allow incoming and try outgoing encryption, retrying without if necessary
3) Using port range 51000-51010
4) I have added the performace boost from the rtorrent wiki, change values back if you don't want this.
5) Seed torrents until ratio = 2.0 with at least 200 MB uploaded or else with a ratio of 20.0
6) You can comment or adjust anything that is not wanted

CODE
nano ~/.rtorrent.rc



#Copy and Paste Below here
#Start of .rtorrent.rc

#Maximum and minimum number of peers to connect to per torrent.
#min_peers = 40
max_peers = 80

# Same as above but for seeding completed torrents (-1 = same as downloading)
#min_peers_seed = 10
max_peers_seed = -1

# Maximum number of simultanious uploads per torrent.
max_uploads = 15

# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 0
upload_rate = 0

# Default directory to save the downloaded torrents.
directory = ~/Torrents

# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = ~/Torrents/session

# Watch a directory for new torrents, and stop those that have been
# deleted.
#schedule = watch_directory,5,5,load_start=~/Torrents/watch/*.torrent
#schedule = untied_directory,5,5,stop_untied=

# Close torrents when diskspace is low.
schedule = low_diskspace,5,60,close_low_diskspace=100M

# Stop torrents when reaching upload ratio in percent,
# when also reaching total upload in bytes, or when
# reaching final upload ratio in percent.
# example: stop at ratio 2.0 with at least 200 MB uploaded, or else ratio 20.0
schedule = ratio,60,60,"stop_on_ratio=200,200M,2000"


# The ip address reported to the tracker.
#ip = 127.0.0.1
#ip = rakshasa.no

# The ip address the listening socket and outgoing connections is
# bound to.
#bind = 127.0.0.1
#bind = rakshasa.no

# Port range to use for listening.
port_range = 51000-51010

# Start opening ports at a random position within the port range.
#port_random = no

# Check hash for finished torrents. Might be usefull until the bug is
# fixed that causes lack of diskspace not to be properly reported.
check_hash = yes

# Set whetever the client should try to connect to UDP trackers.
use_udp_trackers = yes

# Alternative calls to bind and ip that should handle dynamic ip's.
#schedule = ip_tick,0,1800,ip=rakshasa
#schedule = bind_tick,0,1800,bind=rakshasa

# Encryption options, set to none (default) or any combination of the following:
# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext
#
# The example value allows incoming encrypted connections, starts unencrypted
# outgoing connections but retries with encryption if they fail, preferring
# plaintext to RC4 encryption after the encrypted handshake
#
encryption = allow_incoming,try_outgoing,enable_retry

#
# Do not modify the following parameters unless you know what you're doing.
#

# Hash read-ahead controls how many MB to request the kernel to read
# ahead. If the value is too low the disk may not be fully utilized,
# while if too high the kernel might not be able to keep the read
# pages in memory thus end up trashing.
hash_read_ahead = 8

# Interval between attempts to check the hash, in milliseconds.
hash_interval = 10

# Number of attempts to check the hash while using the mincore status,
# before forcing. Overworked systems might need lower values to get a
# decent hash checking rate.
hash_max_tries = 5

# Max number of files to keep open simultaniously.
#max_open_files = 128

# Number of sockets to simultaneously keep open.
#max_open_sockets = <no default>


#Finish of .rtorrent.rc





I like to keep everything in one directory so we create a torrent directory for our uploads and downloads

CODE
mkdir ~/Torrents


Then copy or move the file/folder we want to share to the Torrents directory

CODE
cp /home/username/movies/moviename.avi ~/Torrents
cp /home/username/movies/moviefolder ~/Torrents


or

CODE
mv /home/username/movies/moviename.avi ~/Torrents
mv /home/username/movies/moviefolder ~/Torrents




CREATING A TORRENT

CODE
cd ~/Torrents
ctorrent -t -u "http://tracker.example.com:6969/announce" -s darksiderg.torrent moviename.avi



In our case moviename.avi. Replace this with the directory/file you wish to share.
In our case darksiderg.torrent. Replace this with the name you wish to give your torrent.

This tells ctorrent
-t Create a torrent
-u The Tracker URL
-s The .torrent output name
and the directory/file we want to share.




Then fire up rtorrent.

CODE
rtorrent ~/Torrents/.torrent





I have c&p the keys from the rtorrent userguide so the inormation is all in one place


^q
Initiate shutdown, press again to force the shutdown and skip sending the stop signal to trackers.

up | down | left | right arrow keys, ^P | ^N | ^B | ^F
Select entries or change windows. The right arrow key or ^F is often used for viewing details about the selected entry, while the left arrow key or ^B often returns to the previous screen.


a | s | d
Increase the upload throttle by 1/5/50 KB.

A | S | D
Increase the download throttle by 1/5/50 KB.

z | x | c
Decrease the upload throttle by 1/5/50 KB.

Z | X | C
Decrease the download throttle by 1/5/50 KB.

Main View Keys
->
View download.

1 - 7
Change view.

^S
Start download.

^D
Stop an active download, or remove a stopped download.

^K
Close a torrent and its files.

^R
Initiate hash check of torrent.

^O
Change the destination directory of the download. The torrent must be closed.

^X
Call commands or change settings.

+ | -
Change the priority of the download.

backspace
Add torrent using an URL or file path. Use tab to view directory content and do auto-complete.

l
View log. Exit by pressing the space-bar.

U
Delete the file the torrent is tied to, and clear the association.

I
Toggle whether torrent ignores ratio settings.



Download View Keys

->
View torrent file list. Use the space-bar to change the file priority and * to change the priority of all files. Use / to collapse the directories. OUTDATED

1 | 2
Adjust max uploads.

3 | 4
Adjust min peers.

5 | 6
Adjust max peers.

u
Display transfering blocks.

i
Display chunk rarity.

o
Display the tracker list. Cycle the trackers in a group with the space-bar.

p
View peer and torrent information.

t | T
Initiate tracker request. Use capital T to force the request, ignoring the "min interval" set by the tracker.

k
Disconnect peer.

*
Choke/Snub peer.


Have fun fellow Darksiders drinks.gif
Mazuki
now wouldn't it be easier to instead of copying your movie files, or moving them, to just put the directory in there for the filename? i think so tongue.gif

thank you for the guide though, especially the beginning install, that is the most confusing part of linux for most people methinks

always nice to be able to do whatever you want from command line
syn-ack
QUOTE
now wouldn't it be easier to instead of copying your movie files, or moving them, to just put the directory in there for the filename? i think so tongue.gif


Thanks Mazuki but I have a network filesystem mounted at ~/movies/ and ctorrent had issues for me creating a valid torrent with a the source file as a mounted network filesystem and had some issues with directories that I had not had chance to fix yet wink.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.