Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Deluge (daemon) v 1.2.1 + webui + Flexget - headless on Ubuntu Server

  1. #1
    Join Date
    Feb 2010
    Beans
    91

    HOW TO: Deluge (daemon) v 1.2.x + webui + Flexget - headless on Ubuntu Server

    All this I've got from this website *great tutorial for how to build a media server on ubuntu* Build Media Server

    * all the thanks to Ian that made all those available.

    How to install Deluge (v1.2.x) headless on Ubuntu Server

    Deluge is a great BitTorrent client that you can install on Ubuntu to allow you to share your favourite files with the rest of the BitTorrent community.

    In the newer versions of Ubuntu, Deluge comes in two parts; the server (also called the daemon) and the user interface. This means you can install the Deluge daemon as a headless service and then control it from a remote machine. You can either control the daemon using the Deluge client itself (for example the Windows version of Deluge) or alternatively you can use your browser to control it. If you've not installed VNC and are running a purely headless setup then running Deluge headless is pretty much your only option! So, here's how you install it:

    If you wish to install the released version of Deluge (v1.1.9) then see the guide here: Installing Headless Deluge version 1.1.9

    Updating the Source Repository

    We firstly need to make a simple change to add the Release Candidate version of Deluge as a valid Ubuntu "source repository".

    So, type the following command into your Putty session or directly into the command line on your server to install the PPA:

    Code:
    sudo add-apt-repository ppa:deluge-team/ppa

    Next type/paste:

    Code:
    sudo apt-get update
    Now we need to create a new user called "deluge" and perform a couple more steps. So type/paste the following:

    Code:
    sudo adduser --disabled-password --system --home /var/lib/deluge --gecos "SamRo Deluge server" --group deluge
    Code:
    sudo touch /var/log/deluged.log
    
    sudo touch /var/log/deluge-web.log
    
    sudo chown deluge:deluge /var/log/deluge*
    Install the Deluge Daemon

    Next we'll install the Deluge daemon itself:

    Code:
    sudo apt-get update
    
    sudo apt-get install deluged
    Next we'll install the Web interface by typing:

    Code:
    sudo apt-get install deluge-webui
    Run the Deluge Daemon on startup

    Now we've got the components installed we need to make everything run on start-up. So, let's create the first script we need by typing the following command in a Putty Session:

    Code:
    sudo vim /etc/default/deluge-daemon
    This will create and open a file called deluge-daemon

    Next, assuming you're using Putty, highlight the following 5 commands, right-click on them and select Copy

    Code:
    # Configuration for /etc/init.d/deluge-daemon
    # The init.d script will only run if this variable non-empty.
    DELUGED_USER="deluge"
    # Should we run at startup?
    RUN_AT_STARTUP="YES"
    *when you paste this with windows putty go back at the top of the file and make sure everything was pasted cause sometimes i'm missing some lines or letters!!!

    Toggle back to the Putty Session and press the [Insert] key once and then right click and the 5 lines we've just copied above will be pasted into the file.

    Now press the [Esc] key once and type :wq to save and quit out of the script. If you make a mistake editing the file then issue :q! instead of :wq to abort your changes.

    Creating the "Init Script"

    Now we need an "init script". This script is rather long but we can do some more copying and pasting to implement this script. So, type the following command in your Putty Session to create and open the script:

    Code:
    sudo vim /etc/init.d/deluge-daemon
    Next, highlight and copy this script.

    Toggle back to your Putty Session and press the [Insert] key once and then right click and the whole script you've just highlighted will be pasted into the screen.

    *when you paste this with windows putty go back at the top of the file and make sure everything was pasted cause sometimes i'm missing some lines or letters!!!

    IMPORTANT: By default the init script starts the Deluge Daemon on port 9092. However, Squeezebox Server also uses port 9092. So, if you're installing Squeezebox Server along with this release of Deluge then you must change the port that the Deluge Daemon uses else only one of these two application will work at any one time. ie. you'd have to stop one application running so that you can run the other one. So, the line in the script which currently reads:

    Code:
    DAEMON2_ARGS="-p 9092 -c /var/lib/deluge -l /var/log/deluge-web.log -L warning"
    must be changed to:

    Code:
    DAEMON2_ARGS="-p 8112 -c /var/lib/deluge -l /var/log/deluge-web.log -L warning"
    As before, press the [Esc] key once and type :wq to save and quit out of the script. If you make a mistake editing the file then issue :q! instead of :wq to abort your changes.

    We now need to make this script executable. So:

    Code:
    sudo chmod a+x /etc/init.d/deluge-daemon
    Now we need to make sure this script runs on start-up. To do this type the following command:

    Code:
    sudo update-rc.d deluge-daemon defaults
    Cross your fingers and restart the server by typing the following command:

    Code:
    sudo reboot -h now
    Accessing Deluge via the web interface

    You should now be able to access the Web front-end for Deluge by typing http://MyMediaserver:9092 (or 8112 for port) into the address bar of your browser where MyMediaserver is the name you gave to your server when you installed Ubuntu. Alternatively the IP address of the server works just as well.

    You should now be presented with the Deluge login-screen. Enter deluge for the password and you should then see a screen similar to this:

    Once you are in you could



    Opening the correct ports on your router

    Inorder to start downloading Torrents you need to open up some ports on your router. If you click on the Preferences icon (the screwdriver/spanner) on the Deluge web interface and select Network, the Incoming Ports (the From: and To: ports inclusively) are the ports you need to open on your router. You can obviously change these ports if so wish, but make sure they match your router settings. Make sure you also uncheck the Use Random Ports option if you're going to be opening a specific port range on your router.

    Starting and stopping the web daemon:

    If at any time you want to stop the web daemon then you can do so by issuing the following command:

    Code:
    sudo /etc/init.d/deluge-daemon stop
    To start it again use start instead of stop in the above command. To restart it use restart.


    *IAN NOTE: The above instructions are a summary of the excellent guide which can be found here:


    How to configure RSS for Deluge using FlexGet in Ubuntu

    The classic way to download files using torrents is as follows:

    Go to your favourite torrent site

    Search for the torrent you want

    Once you've found it, download the torrent file manually

    Add the downloaded torrent file to your favourite torrent client

    Once it has finished downloading manually move the file to its final location. (although some torrent clients can do this step for you)

    There is a better way, a fully automated way, and that is to use RSS functionality. So, let's say you're a Lost fan and you currently manually download each episode of Lost as and when it becomes available. Using RSS you can automate this task meaning you can get Deluge to automatically download each episode for you as and when it becomes available. And then, once it's downloaded it will automatically move the file to the location you specify. And this final location can be different for each and every series you download.

    There is a truly excellent tool called FlexGetwhich can do this, and indeed much more. However, FlexGet can be a little tricky to get up and running and so I've explained how I did it below:

    IMPORTANT: Downloading TV shows and the like from the internet can have questionable legality in many countries. So, if you're not familiar with the particular law in your part of the world then let you conscience be your guide as to what you do and do not download!

    Install easy_install[/B]

    First off we need to install a python setup tool called easy_install. So type or paste the following two commands into a Putty session or directly into the command line of your Ubuntu installation:

    Code:
    sudo apt-get update
    
    sudo apt-get install python-setuptools
    Download and install FlexGet

    We now want to download and install FlexGet itself. So, create a temporary download location and switch into it:

    Code:
    mkdir tmp
    
    cd tmp
    Next download FlexGet by typing or pasting the following command:

    *this presumes that you have a version of python 2.6 installed so please check the set up enviroment from flexget website

    Code:
    wget http://download.flexget.com/unstable/FlexGet-1.0r1197-py2.6.egg
    Now install FlexGet:

    Code:
    sudo easy_install FlexGet-1.0r1197-py2.6.egg
    Next, switch back out of the temporary download location and delete this folder and the file within it as we no longer need it:

    Code:
    cd ..
    
    rm -r tmp
    TIP: this tutorial was originally made for a previous version of flexget that was not available anymore. So i can't guaranty it would work for you or if will get you any troubles. I've tested it myself and it worked apparently fine.

    Create the FlexGet working area

    Often scripts and applications are run as the default Ubuntu User. However, the recommendation with FlexGet is to run FlexGet using the "deluge" user. The deluge user is the username the Deluge daemon runs under. If we don't do so then we will hit permission problems since the two parts of the setup (Deluge and FlexGet) will be creating files and folders using different usernames and thus will be using different file/folder permissions.

    So we first need to create the working area which FlexGet will use:

    Code:
    sudo -u deluge mkdir /var/lib/deluge/.flexget
    Next we need to add the deluge user as a valid user for the deluge API. So:

    Code:
    sudo -u deluge vim /var/lib/deluge/auth
    This will open a file called auth which lives in the /var/lib/deluge folder.

    There is already one line in this file but we need to insert an extra line. So press the [Insert] key once (to go into "edit" mode) and insert a new blank line. Next type or paste the following string into this new blank line:

    Code:
    deluge:deluge
    Now press the [Esc] key once and type the following:

    Code:
    :wq
    This should save your changes and bring you back to the command line. If you make a mistake editing the file then issue :q! instead of :wq to abort your changes.

    Create the FlexGet configuration file

    Now we need to create the FlexGet configuration file. The configuration file is where we'll store all the instructions for FlexGet. ie. What to download and from where. So type the following command to create the file and to open it:

    Code:
    sudo -u deluge vim /var/lib/deluge/.flexget/config.yml
    Enter the configuration parameters as required. See the FlexGet website for configuration examples.

    I've included a working example to allow you to test the process is working correctly: Sample config.yml file

    *I means Ian again this tutorial is copied from How to build a Media Server

    Running FlexGet as the "deluge" user

    FlexGet uses an SQL database to keep tabs on what files it has and has not downloaded. The first time you run FlexGet you need to initialise this database. So, run Deluge with the --initdb argument to initialise the database and run the script:

    Code:
    sudo -H -u deluge flexget --initdb
    Thereafter you can omit the --initdb. So:

    Code:
    sudo -H -u deluge flexget
    Run FlexGet as a cron job using webmin

    FlexGet will execute your script each time it runs and pull down any new torrent files it finds. It is therefore desirable to run this script regularly and the best way to do this is via the use of a cron job. I use Webmin to administer my server and creating cron jobs using Webmin is an absolute breeze.

    So, launch Webmin then click on System and then Scheduled Cron Jobs. Then click Create a new scheduled cron job at the top of the screen that opens.

    Click the button next to the Execute cron job as and choose the "deluge" user.

    Type the full path of FlexGet into the Command box. So: /usr/local/bin/flexget

    In the When to Execute section select Simple Schedule and choose Hourly from the drop down list.

    Then click the Create button.

    FlexGet will now check every hour for new torrent files and download them for you. Deluge will then take over and start downloading the actual files themselves.

    How to wipe the database and start over

    As mentioned above, FlexGet will keep a record of what files it has and has not downloaded. If you ever want to wipe everything and start over then issue the following command:

    Code:
    sudo -u deluge rm /var/lib/deluge/.flexget/db-config.sqlite
    TIP: Don't forget to use the --initdb argument the next time you run FlexGet after issuing this command.

    Enjoy!

    * again special thanks to Ian that made this tutorial and many other on his website How to build Media Server

    **EXTRA
    Enable connection through GTK
    to connect through the GTK you have to enable first (by connection through webui) the Allow Remote Connections from Edit -> Preferences -> Daemon
    than return to the terminal on server and we need to add a user and password from the remote connection from GTK

    Code:
      sudo vi /var/lib/deluge/auth
    than enter a new line by pressing o (letter o not number 0) and inster your new "your_username:your_password:level" ex:

    Code:
      obama:obama:10
    exit insert mode and save the file by

    Code:
      :wq
    Enable Scheduler Plugin - you can do that connecting through GTK. The scheduler plugin is not available yet through webui.
    Last edited by gottijr; March 29th, 2010 at 03:58 AM.

  2. #2
    Join Date
    Dec 2006
    Location
    the Netherlands
    Beans
    9
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Deluge (daemon) v 1.2.1 + webui + Flexget - headless on Ubuntu Server

    Thanks for re-posting this here, and of course thanks to the original author for producing it in the first place.
    The addition of flexget is particularly awesome

  3. #3
    Join Date
    Feb 2010
    Beans
    91

    Re: Deluge (daemon) v 1.2.1 + webui + Flexget - headless on Ubuntu Server

    took me too much to figure everything right so i felt that it was needed

    glad u find it helpfull

  4. #4
    Join Date
    Nov 2005
    Location
    Scotland
    Beans
    89
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: Deluge (daemon) v 1.2.1 + webui + Flexget - headless on Ubuntu Server

    You should really reference the Deluge website as it has the upto date init script here that adds the umask option along with the full thin client guide here and you should mention the Deluge FAQ here

    To be honest it would have been more helpful to create/update the guides on the Deluge website as they are wiki based so anyone can update it in the future and then reference them here because the fragmentation that occurs from constantly referencing out of date blogs and forum posts causes more issues.

    Case in point is that the forum topic heading is out of date as version 1.2.2 is out, i suggest using 1.2.x instead.

    One more thing is that is much quicker to install the PPA with this command as it also adds the keys.
    sudo add-apt-repository ppa:deluge-team/ppa
    Last edited by Cas07; March 27th, 2010 at 06:27 PM.

  5. #5
    Join Date
    Dec 2006
    Beans
    380
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Deluge (daemon) v 1.2.1 + webui + Flexget - headless on Ubuntu Server

    Thanks for the post. Anyone having problems with the buttons not working in the Deluge web interface in 10.04? i.e. version 1.2.2.
    Think about how you can solve a problem, not about how it can't be solved.
    Support true GNU/Linux freedom - support REAL Linux standards by supporting efforts for cross-distro app installers/packages.

  6. #6
    Join Date
    Apr 2010
    Beans
    4

    Re: Deluge (daemon) v 1.2.1 + webui + Flexget - headless on Ubuntu Server

    Quote Originally Posted by Yfrwlf View Post
    Thanks for the post. Anyone having problems with the buttons not working in the Deluge web interface in 10.04? i.e. version 1.2.2.
    I have this problem.

  7. #7
    Join Date
    May 2005
    Beans
    7

    Re: Deluge (daemon) v 1.2.1 + webui + Flexget - headless on Ubuntu Server

    I am getting the following error when trying to run deluge via a SSH tunnel. The server and webUI are running fine.

    I tried to "export DISPLAY=0.0" but it did not help. I am running deluge 1.2.2 on lucid.

    Any ideas on how to fix this?


    Code:
    ~$ deluge
    /usr/lib/pymodules/python2.6/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
      warnings.warn(str(e), _gtk.Warning)
    /usr/lib/pymodules/python2.6/deluge/ui/gtkui/gtkui.py:167: GtkWarning: cannot open display: :0.0
      self.gnome_prog = gnome.init("Deluge", deluge.common.get_version())

  8. #8
    Join Date
    Dec 2008
    Location
    Trondheim, Norway
    Beans
    38
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Deluge (daemon) v 1.2.1 + webui + Flexget - headless on Ubuntu Server

    I did as in the guide, trying to "sudo /etc/init.d/deluge-deamon start" and get
    Code:
     * Not starting deluge-daemon, edit /etc/default/deluge-daemon to start it.
    so I assume it is already started, but I still can't get the webUI to open...

    Any suggestions? Trying directly on the server with "http://localhost:8112" (and yes, I've changed the port in the config).

    Thanks in advance, and great job man!

    EDIT: Had to start deluge-web manually, now it works like a charm... Just added "deluge-web --fork" in startup applications
    Last edited by sinnadyr; July 14th, 2010 at 02:48 PM.

  9. #9
    Join Date
    Sep 2006
    Location
    Łódź
    Beans
    1
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Deluge (daemon) v 1.2.1 + webui + Flexget - headless on Ubuntu Server

    hi,
    I'm having trouble setting the autoadd folder.
    Trying to set it to a DropBox enabled folder but always get:

    "autoadd:72 Invalid AutoAdd folder"
    Solved - changed some user settings
    Last edited by lomik; July 21st, 2010 at 08:40 PM. Reason: Solved

  10. #10
    Join Date
    Jun 2008
    Beans
    11

    Re: Deluge (daemon) v 1.2.1 + webui + Flexget - headless on Ubuntu Server

    I got a problem. Everything that has been downloaded by deluge is restricted to sudo or deluge only. I cant delete it with normal user. If i want to do that i have to chmod/chown everything to perform this action. Does somebody has a solution??

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •