Multi user

From AMule Project FAQ
Jump to: navigation, search

Howto setup aMule for multi-user purposes

This article is made to show you how to make optimal use of your internet bandwidth by sharing aMule with multiple users. Often when an internet connection is shared between many persons bandwidth problems occur. People want to download or share files. So p2p applications are installed and the downloadfest can begin. Very soon all upload bandwidth is consumed by these applications and browsing and other useful things you can do with the internet become impossible or really annoying.

Basically, bandwidth restriction of users is a nuisance. Users are not happy because they have too little (in their opinion). A good idea would be to share the same p2p application with all the users. This not only makes it possible to control the upload bandwidth that is spent to p2p, also it can save a lot of energy because only 1 computer has to be turned on all the time to share files.

So what do we need to attain this goal? This is a short list of requirements:

  • Server to run amuled on.
  • aMuleGUI clients compiled for the OS's that different users have installed.
  • A method of handling ed2k:// links remotely.
  • Optional some method of traffic shaping.

Basic server configuration

If you already have a server, read on, else skip ahead to the server hardware example. I only have experience with the OpenSuSE 10.3 operation system so I will use this in my examples to explain things.

aMule user

Firstly it is important to always run the aMuleD in a restricted environment. So we create a user for aMule. Fire up Yast and get to the user management. User management.PNG

Give the user a name, set a password, do not tick the 'Disable User Login' option. Adding amule user.PNG


Next we need initscripts to get aMule started every time we boot our server. A good example for OpenSuSE is:


# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
DAEMON_DESC="aMule daemon"
test -x $DAEMON || { echo "$DAEMON not installed"; 
	if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }

WEB_CMD="$WEB --quiet &"
WEB_DESC="aMule webserver"
test -x $WEB || { echo "$WEB not installed"; 
	if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }

DESC="aMule daemon and webserver"

# Source LSB init functions
. /etc/rc.status

# Reset status of this service

case "$1" in
		echo -n "Starting $DAEMON_DESC "
		su $USER -c "$DAEMON_CMD" > /dev/null
		rc_status -v

		echo -n "Waiting for $DAEMON_DESC to finish initialization "

		while ! netstat -l -n -p -t | grep -q $NAME ; do sleep 1 ; echo 1 ; done
		rc_status -v
		echo -n "Starting $WEB_DESC "
		su $USER -c "$WEB_CMD" > /dev/null 2>&1
		rc_status -v
		echo -n "Shutting down $WEB_DESC "
		/sbin/killproc -TERM $WEB
		rc_status -v

		echo -n "Shutting down $DAEMON_DESC "
		/sbin/killproc -TERM $DAEMON
		rc_status -v
		## Do a restart only if the service was active before.
		## Note: try-restart is now part of LSB (as of 1.9).
		## RH has a similar command named condrestart.
		if test "$1" = "condrestart"; then
			echo "${attn} Use try-restart ${done}(LSB)${attn} rather than c ondrestart ${warn}(RH)${norm}"
		$0 status
		if test $? = 0; then
			$0 restart
			rc_reset	# Not running is not a failure.
		# Remember status and be quiet
		## Stop the service and regardless of whether it was
		## running or not, start it again.
		$0 stop
		$0 start

		# Remember status and be quiet
		## Signal the daemon to reload its config. Most daemons
		## do this on signal 1 (SIGHUP).
		## If it does not support it, restart the service if it
		## is running.

		echo -n "Reload service $DESC "
		## if it supports it:
		## aMule does not support reload

		## Otherwise:
		$0 try-restart
		## Like force-reload, but if daemon does not support
		## signaling, do nothing (!)

		# If it supports signaling:
		## aMule does not support reload
		## Otherwise if it does not support reload:
		rc_failed 3
		rc_status -v
		echo -n "Checking for service aMule daemon"
		## Check status with checkproc(8), if process is running
		## checkproc will return with exit status 0.

		# Return value is slightly different for the status command:
		# 0 - service up and running
		# 1 - service dead, but /var/run/  pid  file exists
		# 2 - service dead, but /var/lock/ lock file exists
		# 3 - service not running (unused)
		# 4 - service status unknown :-(
		# 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
		# NOTE: checkproc returns LSB compliant status values.
		/sbin/checkproc $DAEMON
		# NOTE: rc_status knows that we called this init script with
		# "status" option and adapts its messages accordingly.
		rc_status -v
		echo -n "Checking for service aMule webserver"
		/sbin/checkproc $WEB
		rc_status -v

		echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|r eload}"
		exit 1


Also, don't forget to install the aMule Daemon (and the aMule webservice).

Server hardware example

So you don't have a server yet and want to build one. Here are some things to look out for. First of all I wanted the server to be as energy efficient as possible, while still having enough performance to run aMule.

My personal favorites for hardware are Intel for Processors and Chipsets, so I'll make a choice from those. I chose an Intel E7200 processor, on a motherboard with G33 chipset. Reasonably modern, right now and not too power hungry. The motherboard has onboard video because of the chipset that supports it. A trick is to go for a motherboard that has all the features onboard and as little features as possible that you don't need.

If you have the budget for it you could buy a solid state disk, they are really fast and use very little power. But for me those are too expensive so I decided to go with a harddisk from the Western Digital Green Power range. They also use little power. Just use one disk. DDR memory doesn't use uch power so choose any PC6400. It's cheap these days so 1GB or something would be okay.

To power this all up we need a proper power supply. The trick is to have a power supply that is not too small but also not too big. If it's too small smoke will happen and if it's too big you are wasting power in your supply because it isn't doing what it could be doing. This setup will probably use at peak load something like 100W. Little. You could use PicoPSU or Morex power supplies, they come at low power ratings.

aMuleGUI clients

Set these clients up on your user's systems. Also configure their computers to handle ed2k:// links remotely. Not much special here

Traffic shaping

So everything is set up on the server and your clients can start downloading. But how much bandwith should aMule use? You could set the limits in aMule low to have a lot left over for other purposes. I chose to enable traffic shaping in my firewall and do some other tricks.

aMuleD configuration

Server configuation

Traffic shaping configuration example

The aMule web interface

Open your firewalls

If you own a domain name