AMuleWeb

From AMule Project FAQ
Revision as of 17:21, 17 December 2006 by Colin (Talk | contribs)

Jump to: navigation, search

aMuleWeb is a utility that allows you to control aMule by means of a web browser from any location. The web interface offers a subset of aMule functionality, including searching for files, initializing downloads, and viewing your download queue. It also displays status information and allows you to change certain options.

aMule itself doesn't support HTTP connections; aMuleWeb, which does, therefore serves as an intermediary between aMule and a web browser. Once the link between aMuleWeb and a remote user is established, it connects to aMule via the External Connections interface.

By default, aMuleWeb listens for HTTP connections at port 4711, but this can be changed in Preferences'.

Installing aMuleWeb

Many of not most distros have an aMule package in their repositories. If you install aMule by means of RPM, DEB, or other package management system, aMuleWeb will be included in the installation.

This is the easiest and preferred method of installing aMule and aMuleWeb.

Compiling aMuleWeb

If you have not installed aMule by means of a package, you will need to compile it from source.

aMuleWeb is not compiled separately; it is compiled at the same time you compile aMule by using the --enable-amuleweb flag when you run configure. (See the Main Page for links to pages on compiling aMule for various operating systems).

Configuring aMuleWeb

To use aMuleWeb, you first need to set several opions in aMule's Preferences notebook. On the "Remote Controls" page, you will need to:

  • Enable "Accept External Connections".
  • Enter a password for External Connections.
  • Enable webserver

You can also modifiy the default aMuleWeb port (4711) and External Connections port (4712) here as well, but if you do so, you will need to restart aMule for the changes to take effect.

(If you are running aMuled and don't want to use aMule to configure aMuleWeb, see the instructions below)

Next, you need to do is generate remote.conf, the file where aMuleWeb stores its configuration information. (It can be found in the .aMule directory.) Among other things, this file contains the port number which aMule uses for External Connections as well as the password needed to access aMule.

To create a remote.conf file, enter at the command line:

$ amuleweb -w

aMuleWeb will read the necessary configuration information from amule.conf and generate a remote.conf file, then exit.

Then start aMuleWeb normally:

$ amuleweb

You should now be able to open aMuleWeb in a browser by entering the URL (on the local system):

 http://localhost:4711

or, the with computer's hostname (locally or remote):

 http://hostname:4711:

If you want to run aMuleWeb on a different computer than aMule, just copy remote.conf to the .aMule directory on that computer, and change the hostname line accordingly.

NOTE: aMuleWeb uses cookies to store session information. Make sure that cookies are enabled in your browser.

Launching aMuleWeb

There are two options for launching aMuleWeb.

First, and preferred, is to enable aMuleWeb activation in aMule's preferences. When started, aMule (or aMuled) will launch amuleweb. Upon exit, aMuleWeb will be automatically terminated.

The second option is to run aMuleWeb manually by entering the "amuleweb" command in terminal.

Configuring aMuleWeb with aMuled

First, if aMuled is running, shut it down.

Then run:

 $ amuleweb -w

to generate a remote.conf file. You will need to edit these options in the [ExternalConnect] section:

  • AcceptExternalConnections=1 <-- To enable External Connections.
  • ECPassword=ca3c365274907c6fd527068788e14639 <-- MD5 string

You can then restart amuled and amuleweb.

NOTE: Passwords must be md5sum format. To generate an MD5sum for your password, run:

$ echo -n yourpasswordhere | md5sum | cut -d ' ' -f 1
ca3c365274907c6fd527068788e14639

NoteIf you get FATAL ERROR: Cannot find template: default it's because you didn't run make install. If you don't want to install aMule, copy the src/webserver/default/ directory into ~/.aMule/webserver/ (create it if needed). If you want any other template (probably php-default), copy it too. Then go back to the previous step.


aMuleWeb with older versions of aMule

For instructions for using aMuleWeb with aMule pre-2.0.0 final, see this page for archived material.

Standard ports

The ports can be set to anything, but by default aMule uses:

  • External Connections: 4712
  • amuleweb: 4711

Make sure you do not confuse the two; in the default configuration, it looks like this:

aMule --> [4712] --> aMuleWeb --> [4711] --> web browser

Template (skin) location

aMuleWeb looks for its files in a number of places:

  • In your home directory: $HOME/.aMule/webserver/[skin name]/
  • And at its install location, in this order (by default, /usr/local/share/amule/webserver if you compiled aMule, or /usr/share/amule/webserver if you installed it from a package).

Default template name is 'default'.

If, after installing aMule, aMuleWeb refuses to run because of not being able to load template:

  • Please report this situation to us, and then
  • Create the directories webserver/default in the .aMule subdirectory of your home directory, and copy the contents of the src/webserver directory there from the aMule tarball (ie, $HOME/.aMule/webserver/default).

aMuled and aMuleWeb as services

Although starting aMuleWeb by enabling it inaMule's preferences is the preferred method, you can also run aMuleWeb together with aMuled as as services by means of an init.d script. Here is an example:

/etc/init.d/amule

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/amuled
WEB=/usr/bin/amuleweb
NAME=amuled
DESC=amuled
RUNAMULE=no
USER=youramuleuser

test -x $DAEMON || exit 0

# Include amule defaults if available
if [ -f /etc/default/amule ] ; then
    . /etc/default/amule
fi
if [ "$RUNAMULE" != "yes" ];then
    echo "Amule not to be started. Edit /etc/default/amule first."
    exit 1
fi

set -e

case "$1" in
  start)
    echo -n "Starting $DESC: "
       su $USER -c "$DAEMON -f"
       while ! netstat -l -n -p -t | grep -q amuled ; do sleep 1 ; done
       su $USER -c "$WEB --quiet &"
    echo "$NAME."
    ;;
  stop)
    echo -n "Stopping $DESC: "
       killall --quiet --ignore-case $WEB
       killall --quiet --ignore-case $DAEMON
    echo "$NAME."
    ;;
  restart|force-reload)
    echo -n "Restarting $DESC: "
       killall --quiet --ignore-case $WEB
       killall --quiet --ignore-case $DAEMON
    sleep 1
       su $USER -c "$DAEMON -f"
       while ! netstat -l -n -p -t | grep -q amuled ; do sleep 1 ; done
       su $USER -c "$WEB --quiet &"
    echo "$NAME."
    ;;
  *)
    N=/etc/init.d/$NAME
    echo "Usage: $N {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0

Then just set that script to be run at start up. On Debian this would be doen with the following command:

update-rc.d amule defaults

Then, for the daemons to start you just have to create a file /etc/default/amule which contains a single line:

RUNAMULE=yes

Template language and development

Simply put, aMuleWeb templates are ordinary HTML files. In order to make them "interactive", server-side language is embedded inside. This language is scaled down dialect of PHP. More detailed information can be found on aMuleWeb_PHP.

Where to report problems and questions?

For Problems or Questions just report on http://forum.amule.org forum or join IRC channel #amule at irc.freenode.net

Other sources of information

Read the aMuleWeb man page, which is available in English, French, German, Hungarian and Spanish.

For further information read the aMuleWeb FAQ.