Difference between revisions of "AMuleWeb"

From AMule Project FAQ
Jump to: navigation, search
(aMuled and aMuleWeb as services)
 
(36 intermediate revisions by 24 users not shown)
Line 1: Line 1:
== Description ==
+
<center>'''English''' | [[AMuleWeb-de|Deutsch]] | [[AMuleWeb-it|Italiano]] </center>
  
aMuleWeb is a utility that listens for [http://www.w3.org/MarkUp HTTP] connections at port 4711 (by default, although it can be changed through '''Preferences''') and allows remote users to control [[aMule]] using just a web browser.  
+
'''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 listening to [http://www.w3.org/MarkUp HTTP] connections, so the external utility aMuleWeb is used. This utility listens for remote connections, and once the link between aMuleWeb and the remote user is established, it connects to the [[aMule]] main program using the [[External Connections]] mechanism.
+
aMule itself doesn't support [http://www.w3.org/MarkUp 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.
  
== Compiling aMuleWeb ==
+
By default, aMuleWeb listens for HTTP connections at port 4711, but this can be changed in [[Usage Preferences|Preferences]]'.
  
[[Compile]] [[aMule]] normally, just add ''--enable-amuleweb'' whe nrunning ''configure''.
+
== Set a password ==
  
== Setting up aMuleWeb with [[aMule]] ==
+
To connect to the web server a password must be set, otherwise connection is refused. To set a password run aMuleWeb with --admin-pass=your_password.
  
=== aMuleWeb with [[aMule]] 2.0.0 or later ===
+
== Standard ports ==
  
*For users running the monotlithic [[aMule]] application:
+
The ports can be set to anything, but by default aMule uses:
**Go to "Preferences"->"Remote Controls" (in [[aMule]]) and...
+
***Enable "Accept External Connections".
+
***Enable "Use TCP ports instead of unix local sockets" (This option doesn't exist since version 2.0.1)
+
***Enter a password for [[External Connections]]. If you don't do this, aMuleWeb will not communicate with [[aMule]].
+
::'''NOTE:''' When you change your aMuleWeb and [[External Connections]] ports here, make sure to restart [[aMule]].
+
  
*For users running the [[aMule|aMule daemon]]:
+
*External Connections: 4712
**Shutdown [[aMule|aMuled]] if it is still running.
+
*amuleweb: 4711
**Run ''amuleweb -w'' to generate ''~/.aMule/remote.conf'' and edit it for these options. It previously were on ''~/.aMule/amule.conf'', but the lines are still on this file, so edit both if in doubt.
+
***''[ExternalConnect]'' <- Section header
+
***''AcceptExternalConnections=1'' <-- To enable [[aMule]] listening for [[External Connections]].
+
***''ECUseTCPPort=1'' <-- To use the [http://www.faqs.org/faqs/internet/tcp-ip/resource-list TCP] port. Very important since [http://www.unix.org Unix] sockets are disabled.
+
***''ECPassword=ca3c365274907c6fd527068788e14639'' <-- To find the MD5 string for your password, do:
+
:::''$ echo -n yourpasswordhere | md5sum | cut -d ' ' -f 1''
+
:::''ca3c365274907c6fd527068788e14639''
+
**Restart [[aMule|aMuled]]
+
  
'''NOTE:''' In [[aMule]] version 2.0.0 and later you don't need to do any copy/link of [[aMuleWeb|webserver]] files.
+
Make sure you do not confuse the two; in the default configuration, it looks like this:
  
Thanks to [[User:Stefanero|Stefanero]], from who I shamelessly stole a lot from his tutorial.
+
aMule --&gt; <nowiki>[</nowiki>4712<nowiki>]</nowiki> --&gt; aMuleWeb --&gt; <nowiki>[</nowiki>4711<nowiki>]</nowiki> --&gt; web browser
  
=== aMuleWeb with [[aMule]] 2.0.0-rcX versions ===
+
== Template (skin) location ==
  
*[http://www.gnu.org/software/tar/tar.html Untar] the sources and copy '''''src/aMule.tmpl''''' or in new versions (you are using a ''new version'' if you don't have the file ''aMule.tmpl'' in ''src/'') only the following dir '''''src/webserver/''''' into your '''''~/.aMule/''''' directory. The following (run from the sources directory), should do so:
+
aMuleWeb looks for its files in a number of places:
:''$ cp -r src/aMule.tmpl src/webserver/ ~/.aMule/''
+
  
* If you installed [[aMule]] from rpm, then you can do:
+
*In your home directory: ''$HOME/.aMule/webserver/''<nowiki>[</nowiki>skin name<nowiki>]</nowiki>''/''
:''$ cp /usr/share/amuleweb/aMule.tmpl ~/.aMule/''
+
:''$ cp -r /usr/share/amuleweb/webserver/ ~/.aMule/''
+
:'''NOTE''': Note that in current versions (since [[aMule]] 2.0.0) the above step is not necessary (in fact, it is incorrect).
+
  
*Go to "Preferences"->"Remote Controls" (in [[aMule]]) and...
+
*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).
**Enable "Accept External Connections".
+
**Enable "Use TCP ports instead of unix local sockets".
+
**Enter a password for external connections. If you don't do this, amuleweb will not communicate with amule.
+
  
::'''NOTE:''' On some early [[aMule]] 2.0.0-rcX versions the above options weren't available (or didn't work). Use this if you want to run [[aMuled]], too. If you are using such [[aMule]] version and you don't wish to upgrade, then do the following:
+
Default template name is 'default'.
  
:Shutdown [[aMule]] if it is still running.
+
If, ''after installing'' aMule, aMuleWeb refuses to run because of not being able to load template:
:Edit your ''~/.eMule'' file, locate the ''[ExternalConnect]'' section and change:
+
::''AcceptExternalConnections=1'' <-- To enable [[aMule]] listening for [[External Connections]].
+
::''ECUseTCPPort=1'' <-- To use the [http://www.faqs.org/faqs/internet/tcp-ip/resource-list TCP] port. Very important since [http://www.unix.org Unix] sockets are disabled.
+
::''ECPassword=ca3c365274907c6fd527068788e14639'' <-- To find the MD5 string for your password, do:
+
:::''$ echo -n yourpasswordhere | md5sum | cut -d ' ' -f 1''
+
:::''ca3c365274907c6fd527068788e14639''
+
  
::'''NOTE:''' Since [[aMule]] 2.0.0 the ''~/.eMule'' file is now called ''~/.aMule/amule.conf''.
+
*Please report this situation to us, and then
  
*Restart [[aMule]]
+
*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'').
  
*Go to your "Preferences"->"Remote Controls" (in [[aMule]]) and setup your passwords here for [[External Connections]] and aMuleWeb login.
+
== aMuled and aMuleWeb as services  ==
::'''NOTE:''' When you change your aMuleWeb and [[External Connections]] ports here, make sure to restart [[aMule]].
+
::'''NOTE:''' that ''"Enable aMuleWeb"'' has no effect and will be renamed in 2.0.0rc8. aMuleWeb is always enabled as long as you have [[External Connections]] enabled.
+
::'''NOTE:''' For users running [[aMuled|aMule Daemon]] you have to edit the ''.eMule'' file like shown above. For a way to setup a password check the [[Webserver-1.2.x|1.2.8 aMule HowTo]]. You can still do it in the same way.
+
  
*Now you're done! You are ready to run amuleweb and connect to it.
+
Although starting aMuleWeb by enabling it in aMule'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:
  
'''[[User:Stefanero|Stefanero]]'''
+
''/etc/init.d/amule''
  
=== Webserver with aMule 1.2.8 or earlier ===
+
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 <nowiki>[</nowiki> -f /etc/default/amule <nowiki>]</nowiki> ; then
 +
    . /etc/default/amule
 +
fi
 +
 +
if <nowiki>[</nowiki> "$RUNAMULE" != "yes" <nowiki>]</nowiki> ; 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 &amp;"
 +
    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 &amp;"
 +
    echo "$NAME."
 +
    ;;
 +
  *)
 +
    N=/etc/init.d/$NAME
 +
    echo "Usage: $N {start|stop|restart|force-reload}" &gt;&2
 +
    exit 1
 +
    ;;
 +
esac
 +
 +
exit 0
  
The following is based on the original instruction by BigBob. They guide you on how to modify [[aMule]]'s configuration files to set aMuleWeb correctly.
 
  
There is "Preferences"->"Remote Controls" now, but anyway, information is never a bad idea.
 
  
*Shutdown [[aMule]] to avoid overwritting config files while shutting down.
+
Then just set that script to be run at start up. On [[Debian]] this would be done with the following command:
*Copy from [[aMule]]'s sources (version 1.2.4 or later) the directory ''src/webserver/'' into your ''~/.aMule/webserver/'' directory.
+
*Copy from [[aMule]]'s sources (version 1.2.4 or later) the file ''src/aMule.tmpl'' into your ''~/.aMule/aMule.tmpl'' directory.
+
*Open a terminal and type (you might have to install ''[http://www.delorie.com/gnu/docs/textutils/md5sum.1.html md5sum]''):
+
:''echo -n "'''THEPASWORDYOUWANT'''" | md5sum | cut -d " " -f 1''
+
:This command will reply with an [[MD4 hash|MD5 hash]]. Something like: 324f85f6095f9e5fe25b6c85af44b445
+
*Edit your ''~/.eMule'' file, locate the ''[ExternalConnect]'' section in it and change this fields:
+
:''AcceptExternalConnections=1'' <- To enable [[aMule]] to listen for [[External Connections]].
+
:''ECUseTCPPort=0'' <- Set this to 1 to use the [http://www.faqs.org/faqs/internet/tcp-ip/resource-list TCP] port. If disabled [[External Connections]] will fail!!
+
:''ECPort=4712'' <- Put here the port on which you want [[aMule]] to listen for [[External Connections]].
+
:''ECPassword=39e5049d0614baf21906500e2261d500'' <- Put here the password for [[External Connections]]<nowiki>'</nowiki> authentications you generated before in terminal (something like 324f85f6095f9e5fe25b6c85af44b445).
+
*Edit your ''~/.eMule'' file, locate the ''[WebServer]'' section in it and change fields:
+
:''Password=324f85f6095f9e5fe25b6c85af44b445'' <- Put here the password generated with [http://www.delorie.com/gnu/docs/textutils/md5sum.1.html md5sum] for the admin (full privileged users).
+
:''PasswordLow=1db5a746266e941b3ef7dd3586863ca7'' <- Put here the password generated with [http://www.delorie.com/gnu/docs/textutils/md5sum.1.html md5sum] for "low users" (low privileged users).
+
:''Port=10000'' <- Put the port you want aMuleWeb to listen on.
+
:''Enabled=1'' <- This option has been deprecated and is completly ignored now. Enabling External Connections will enable any application it connects to it, including [[aMuleWeb]].
+
:''UseGzip=1'' <- Enable compression on communication.
+
:''PageRefreshTime=120'' <- Put here the web page refresh time (in seconds).
+
:''UseLowRightsUser=0'' <- 0/1 (disabled/enabled) "low user" access.
+
*Restart [[aMule]].
+
*Once [[aMule]] is running, start the web interface (aMuleWeb).
+
*Now point your web browser to http://localhost:10000 (or whatever your host and ports are) and authenticate yourself with "Password" (for full privileged user) or "PasswordLow" (for low privileged user, if enabled).
+
*That's all :)
+
  
:'''NOTE:'' In latest [[aMule]] 1.2.x releases, the option ''WebTemplateFile'' allows to override the file template to use (thanks to [[User:Stefanero|Stefanero]]. You can set this option in the ''[eMule]'' section. Example:
+
update-rc.d amule defaults
  
:''WebTemplateFile=eMule.tmpl''
+
Then, for the daemons to start you just have to create a file ''/etc/default/amule'' which contains a single line:
  
== Connecting to aMuleWeb ==
+
RUNAMULE=yes
  
To run aMuleWeb run '''''amuleweb''''' on a terminal.
 
  
Once aMuleWeb is running, open a web browser and connect to:
+
=== Ubuntu ===
  
''http://host:port''
+
Ubuntu has a script in /etc/init.d already called amule-daemon
 
+
where ''host'' stands for your host's name (try with ''localhost'') and port stands for the aMuleWeb port ('''NOT''' the [[External Connections]] port).
+
 
+
For example: ''http://localhost:4711''
+
 
+
''Shakraw''
+
 
+
== Standard ports ==
+
 
+
The ports can be set to anything, but this are the most used (the standard ones):
+
 
+
*[[External Connections]]: 4712
+
*amuleweb: 4711
+
 
+
Make sure you do not confuse with what each of them is.
+
 
+
== Skin support ==
+
 
+
aMuleWeb now looks for its files in a number of places:
+
*In your home directory: ''$HOME/.aMule/webserver/''[skin name]''/''
+
*And at it's 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 skin (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 (I mean to ''$HOME/.aMule/webserver/default'').
+
  
'''[[User:GonoszTopi|GonoszTopi]]'''
+
You need to set the user by editing /etc/default/amule-daemon, and amuled will be started as that user.
  
 
== Where to report problems and questions? ==
 
== Where to report problems and questions? ==

Latest revision as of 00:49, 1 August 2009

English | Deutsch | Italiano

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'.

Set a password

To connect to the web server a password must be set, otherwise connection is refused. To set a password run aMuleWeb with --admin-pass=your_password.

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 in aMule'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 done 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


Ubuntu

Ubuntu has a script in /etc/init.d already called amule-daemon

You need to set the user by editing /etc/default/amule-daemon, and amuled will be started as that user.

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.