How To Create and Seed a Torrent in Ubuntu Using Transmission Command Line
You may have a server with limited (free) monthly bandwidth, but yet need to share some large files or files that need to be accessed by a large number of people. Instead of sharing your files via your HTTP server, you can share them via BitTorrent instead in order to hopefully save bandwidth.
Here are the steps I followed on Ubuntu 11.10, but they should work with any version of Ubuntu, Debian and Mint.
- Install transmission client and daemon
sudo apt-get install transmission-cli transmission-daemon
- Create a directory to share your files and .torrent files
- Copy your file in that directory and create the torrent file with transmission-cli
transmission-create ubuntu.bin.7z -t udp://tracker.openbittorrent.com:80
- Start transmission-daemon
transmission-daemon -c ~/p2p
That’s all your need to do. If you want to monitor transmission remotly via a web interface, you can instead run transmission-daemon as follows:
transmission-daemon -c ~/p2p -a public_ip
Where public_ip is the public ip of your computer. Alternatively, you could also use dynamic DNS instead.
The final step would be to share the torrent file, you can sent it to selected persons or simply share in your http server e.g.:
sudo cp ~/p2p/ubuntu.bin.7z.torrent.added /var/www/public_html/torrent
sudo chown www-data.www-data /var/www/public_html/torrent/ubuntu.bin.7z.torrent.added
Users can then download your file via BitTorrent, by download the torrent file from your server and an address that looks like:
and start download your file as they would do with any torrent.
transmission-daemon will start automatically each time you start your server, with the settings defined in /etc/transmission-daemon/settings.json and as user ‘debian-transmission’.
You’ll need to edit settings.json and add 2 lines to include the watch dir:
"watch-dir": "/home/user/p2p", "watch-dir-enabled": true
and make sure the directory can be access by debian-transmission user:
chown debian-transmission.debian-transmission /home/user/p2p
You may also need to add “user” to debian-transmission group, if you are going to copy file to /home/user/p2p with that user:
sudo service transmission-daemon stop sudo usermod --append -G debian-transmission user sudo service transmission-daemon start
You can find more details about configuring transmission-daemon at https://trac.transmissionbt.com/wiki/EditConfigFiles.