F2 Amule

From FON Wiki Beta

Jump to: navigation, search
Changes and instructions described in this page are meant to be done by developers only. Applying these changes to your La Fonera might irremediably damage it. FON will not be held responsible for their consequences. Read instructions carefully!

Contents

Installing Amule

Sources

or

svn co http://svn.fonosfera.org/fon-ng/trunk fon-ng
cd fon-ng
./install.sh
cd openwrt
./scripts/feeds update -i
./scripts/feeds update -a
./scripts/feeds install amule
  • installing package amule,libpng,wxbase,libcrypto++,gd,jpeg
    • Issue with libreadline
make menuconfig
  • check for destination : Fonera+, Fonera2.0G (MIPS), Fonera 2.0N (mipsel!)
  • network->P2P->Amule : M
  • exit
make V=99
  • check bin/packages/mipsel (fonera 2.0n) or bin/packages/mips (fonera2.0g) and find :
amule_2.2.6-1_mipsel.ipk
libpng_1.2.40-1_mipsel.ipk
libwxbase_2.8.10-1_mipsel.ipk
libcryptoxx_5.6.0_mipsel.ipk
libstdcpp_4.1.2-13_mipsel.ipk
cd /tmp
mkdir amule
cd amule 
wget http://flash.fonera.be/FON2303/packages/mipsel/amule_2.2.6-1_mipsel.ipk
...
  • BEWARE!!! Amule is BIG ... you should not install it with "opkg install" nor on your / nor in /tmp
    • The Fonera 2.0G and 2.0N can use an USB stick for these big programs... Fonera+ will require to be run from a remote network disk using CIFS

installation

  • unzip each package and the data package within, the rest can be deleted
tar xzvf amule_2.2.6-1_mipsel.ipk
tar xzvf data.tar.gz
rm amule_2_2_6-1_mipsel.ipk
rm data.tar.gz
rm control.tar.gz
rm debian*
  • Now do this with all the above packages
  • now to make it start at every boot: (change "20gb" with the name you gave your external usb drive that holds your /amule folder)
cd /etc/init.d
vi amule
#!/bin/sh
ln -s /tmp/mounts/20gb/amule /home/.aMule
ln -s /tmp/mounts/20gb/amule /root/.Amule
export LD_LIBRARY_PATH=/lib:/usr/lib:/tmp/mounts/20gb/amule/usr/lib:/tmp/mounts/20gb/amule/lib
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/home/.aMule/usr/bin
iptables -I input_daemon -p tcp --dport 4662 -j zone_wan_ACCEPT
iptables -I input_daemon -p udp --dport 4662 -j zone_wan_ACCEPT
iptables -I input_daemon -p tcp --dport 4711 -j zone_wan_ACCEPT
cd /home/.aMule
amuled -f -c /home/.aMule
<escape>:wq
  • /etc/init.d/amule start
    • if it works:
      • /etc/init.d/amule enable

Configuration

  • check port 4662 & 4711, enable external connections/webserver/template
vi /tmp/mounts/20gb/amule/amule.conf




wget -O /etc/init.d/aMule http://www.lorenzobraghetto.com/wp-content/uploads/bridge && chmod +x /etc/init.d/bridge

Nov 05 10:29:05 <blathijs> Ah, you didn't try yet :-) Nov 05 10:29:13 <xmff> then /etc/init.d/bridge start Nov 05 10:29:23 <xmff> if start works, do /etc/init.d/bridge enable Nov 05 10:29:49 <blathijs> Barbon: But didn't you say the bridge script broke your internet connection? How's that possible if you didn't try it yet? Nov 05 10:29:54 <xmff> after you did "enable" it will start automatically on each boot, so make sure it does not brick your fonera before you permanently enable it

Remarks

  • The La Fonera 2.0 has not enough memory to install the Amule Package including all it's dependancies.
  • But it has also no memory to download eg an entire Linux Distribution (let's keep legal :-)

Solution

  • La Fonera 2.0 has a USB 2.0 port...
  • La Fonera 2.0 supports usb memory sticks out of the box

installation

  • Plug in your memory stick
  • Check which name it got & memorize it
ls /tmp/mounts

opkg

vi /etc/opkg.conf
dest usb /tmp/mounts/Disc-A1
  • press : followed by wq!
opkg update

profile

vi /etc/profile
  • The following is my new & improved profile
#!/bin/sh
[ -f /etc/banner ] && cat /etc/banner
ext_path='/tmp/mounts/Disc-A1'
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:$ext_path/usr/sbin:$ext_path/usr/bin
export LD_LIBRARY_PATH=/lib:/usr/lib:/$ext_path/usr/lib:$ext_path/lib
export HOME=/root
export PS1='\u@\h:\w\$ '
[ -x /bin/more ] || alias more=less
[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
[ -x /sbin/arp ] || arp() { cat /proc/net/arp; }
[ -z /bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
  • now let's reload our updated profile shall we?
. /etc/profile
  • It should yield no errors!

prepare your usb stick to become EXT2 formatted

  • opkg -dest usb install fdisk
  • opkg -dest usb install e2fsprogs
  • ls /dev|grep sd
  • check if your usb stick is sda1... sdb1.... and change the following line so you are formatting the correct one..
  • mkfs.ext2 -m 0 /dev/sda1
<STILL UNDER CONSTRUCTION>
But http://wiki.openwrt.org/UsbStorageHowto is a nice read

Installation #1

opkg -dest usb install amule
  • we will get a lot of errors due to other dependencies missing...just do opkg -dest usb install <missing dependancy>
  • TIP : libz.so.0 can be installed with opkg -dest usb install zlib

Installation #2

ln -s /tmp/mounts/Disc-A1 /tmp/shared 
cd /tmp/shared
wget http://www.fonera.be/extras/amule/amule-fon2.tgz -O amule-fon2.tgz
tar zxvf amule-fon2.tgz
rm amule-fon2.tgz
  • let's create your unique password...change haslo in your own password...we'll MD5-hash it
echo -n haslo | md5sum | cut -d ' ' -f 1
vi /tmp/shared/home/amule/.aMule/amule.conf
  • now find & replace ## with your password
[eMule]
IPFilterAutoLoad=0
[WebServer]
Enabled=1
Password=###
Template=php-default
[ExternalConnect]
AcceptExternalConnections=1
ECPassword=###
ShowProgressBar=1
  • from http://ed2k.2x4u.de put a nice server.met on /tmp/shared/home/amule/.aMule
  • Another symbolic link
ln -s /tmp/shared/share/amule/webserver/ /tmp/shared/home/amule/.aMule/webserver
  • start Amule in "debug" with
/tmp/shared/bin/amule debug
  • if no errors are shown... ctrl-c and restart it with:
/tmp/shared/bin/amule start
  • to make it start up at the next reboot of your Fonera 2?
touch /etc/rc.d/S99amule
chmod 755 /etc/rc.d/S99amule
vi S99amule
  • S99amule - do change Disc-A1 in the proper naming
#!/bin/sh
ln -s /tmp/mounts/Disc-A1 /tmp/shared
/tmp/shared/bin/amule start

Addendum

Adding hotplug support

  • locate the amule installation dynamically when an usb stick is entered & start up amule :-)
vi /etc/hotplug.d/usb
for part in part*; do
           path=/tmp/mounts/${dev}_${part##*part}
           mkdir -p ${path}
           mount ${part} ${path}
           if [ -f ${path}/bin/amule ]; then 
               ln -s ${path} /tmp/shared
               /tmp/shared/bin/amule start
           fi
       done
  • there is no "eject" button on the fonera2...otherwhise a Asus-WL500g trick could be performed
 if [ "$BUTTON" = "ses" ] ; then
           if [ "$ACTION" = "pressed" ] ; then
               if [ -f /tmp/shared/bin/amule ]; then 
                   /tmp/shared/bin/amule stop
                   umount /dev/sda1
                   sleep 3
               fi
           fi
       fi

Opening firewall ports

  • default Amule listens on 4711 (webserver) and 4602 for incoming ed2k requests with the following in your firewall.user you can enable these ports
iptables -I INPUT -p tcp --dport 4602 -j ACCEPT
iptables -I INPUT -p tcp --dport 4711 -j ACCEPT
  • if this works we could perhaps make it more permanent by editing the following file :
vi /etc/config/services
config 'service' 'amule'
       option 'name' 'amule'
#      option 'path' '/usr/sbin/amuled'
#      option 'process' '1'
       list 'tcp_port' '4062'
       list 'tcp_port' '4711'
       list 'udp_port' '4062'
       option 'fwall' '1'

Contributions

Personal tools