As a final post on my series of posts about how to get a low-cost and low-energy consumption HTPC via a combination of pandaboard and RPi, I'll talk about how to setup the ed2k download client aMule (the Linux port of the famous Emule) so you can leave it there forever, making sure it is fail-proof in the process, thanks to Monit.
aMule
The reason for me to choose aMule as my P2P client is mostly because I never liked torrents. This is just a personal opinion, but I've always have the impression that torrent users don't share as much as "good-old-donkey" ones. Besides, I like watching old stuff, something very hard to find in torrent format. Having said that, let's go down to installing and configuring aMule in your download server.
You'll end up in love with your mule like this girl, serious |
In my case, that was a pandaboard set up as depicted in my previous post. I've alway been using eMule & aMule downloading the client and using it directly in the same machine. While this works sweet in normal Linux distributions, I've found it really hard in my panda, due basically to two reasons: First, I'm accesing my X session through VNC, and it is slow. Not bad for normal surfing and just do casual work, but it is uncomfortable after some time. And second, and this one is really frustrating, never managed to include e2dk links clicked in any Web browser automatically to aMule.
This may look like I enjoy whining about minor issues, but I just can't bare having to copy & paste e2dk links from one place to another. Maybe if I didn't know the feature existed, I wouldn't mind, but since I do, I just can't go on it without it. The reason for this is still unknown for me. I've searched for days and still can't find a definitve answer, but, for some reason, my Firefox version is not able to interpret e2dk links. Don't think is a Firefox issue really, I've also tried Midori, Chromium and even Konqueror, to no avail. All failed miserably.
Tried all sort of supposed solutions, like using ML Donkey Protocol Handler Firefox plugin, or the Chromium one, no luck. Also tried to set up some values in Firefox config, but did not work either. I was about to give up when I just realized (yeah, blame me I was too slow on this) that why not trying to use aMule daemon so I could use aMule without having to login and interact directly with the pandaboard? There are a lot of advantages using this approach, but the most interesting for me are:
- You can manage your downloads from any other place with the aMuleWeb front-end, or the aMuleGUI if you prefer
- No need to physically or remotely connect to the machine. This is a big plus for me, I just didn't realize how comfy it is to access my downloads from a web browser, no ssh-ing, no vnc-ing, just a plain URL.
- You don't even need to have a graphical interface at all in the machine running aMule daemon. There are some examples of people deploying aMule in Linux capable routers.
So there are basically two options: get aMule daemon and aMule Web from official repositories or download sources and compile. First option is quicker and easier, second will give you more control but its obviously more work. Unless you need some specific functionality, the provided packages in repositories are more than enough. This is the approach I used too. Let's go to it:
- Download and install amuled
$ sudo apt-get install amule-daemon
$ amuled
$ vi /home/your_user/.aMule/amule.conf
AcceptExternalConnections=1
echo -n yourpasswordhere | md5sum | cut -d ' ' -f 1
ECPassword=your_password_md5hash
sudo service amule-daemon start
aMuleWeb
In order to be able to access our amule-daemon and send ed2k links, we're gonna use amuleWeb, a web-based front-end application to manage aMule that works pretty well. aMuleWeb is already installed if you followed the instructions above, but must be configured:
- Create the configuration file for amuleWeb. Don't worry about the password fields, we'll fix that later. This will generate a remote.conf file in the same place as the amule.conf one. You can also specify other important things in this file, like listening port, server name, etc. I left the ones by default, but feel free to modify them to suit your needs.
$ amuleweb --write-config --host=localhost --password=password --admin-pass=anotherpassword
$ vi /home/your_user/.aMule/remote.conf
$ AdminPassword=your_password_md5hashIn order to run amuled + amuleWeb as a service on startup, you must follow these steps:
- Try to add amuled to startup scripts.
$ sudo /etc/init.d/amule-daemon
$ * Not starting aMule daemon, AMULED_USER not set in /etc/default/amule-daemon.
$ sudo vi /etc/default/amule-daemon $ AMULED_USER="your_user"
$ vi /home/your_user/.aMule/amule.conf $ Enabled=1 Template=default Password=your_password_md5hash
$ sudo reboot
aMuleWeb up&running |
- Lastly, if you haven't done already, open required ports in your router for amule-daemon and amuleWeb. Default ones are 4672 TPC, 4662 UDP and 4711 TCP.
monit
Last step involves installing monit to supervise (among many other things) that amule daemon is up and running. Monit is a great tool used to supervise all kind of things, but mostly, running services that could be critical in a server (like Apache, MySQL, PostgreSQL, FTP, whatever...) or CPU usage, RAM, etc. You can define alarms or thresholds and monit will check those rules and do whatever you specify when something happens, normally restarting the service.
One monit to rule them all |
In our case, we'll use monit to watch if amule-daemon is down and if so, log a message and restart the amule-daemon service.
- Install monit
$ sudo apt-get install monit
$ sudo vi /etc/monit/monitrc
$ set daemon 120 # check services at 2-minute intervals
$ set logfile /var/log/monit.log
$ set httpd port 2812 use address localhost # only accept connection from localhost allow localhost # allow localhost to connect to the server and allow admin:your_pass_here # require user 'admin' with password 'monit'
$ #Included for amule-daemon check process aMule with pidfile /home/your_user/.aMule/muleLock start program = "/etc/init.d/amule-daemon start" stop program = "/etc/init.d/amule-daemon stop" if failed host localhost port 4711 then restart
$ sudo service monit restart
That's it! You should have by now a working amule daemon with amuleWeb under supervision by monit and almost be as happy as me with this setup :).
Thank you for sharing useful information with us. please keep sharing like this. And if you are searching a unique and Top University in India, Colleges discovery platform, which connects students or working professionals with Universities/colleges, at the same time offering information about colleges, courses, entrance exam details, admission notifications, scholarships, and all related topics. Please visit below links:
ReplyDeleteDr. CV Raman University in Bilaspur
ICFAI University in Ranchi
AISECT University in Hazaribagh
Integral university in Lucknow
Amity University in Raipur