[How-To] Install aMule in a Jail

Status
Not open for further replies.

Chipmunk

Cadet
Joined
Oct 26, 2014
Messages
8
I wanted to run aMule in my 9.2 FreeNas but I wasn't able to find anything "ready to go" on the net (too obsolete?), so I put something together myself. Should anyone be interested, feel free to use it as a sort of How-To.

DISCLAIMER: it worked for me (so far) on a FreeNAS 9.2. The following instructions are therefore specific for that distribution and may require a little fine tuning on other releases, although I wouldn't expect any major change on the procedure

This work is loosely based on the following posts, relating to similar installs on other BSD distros:

http://forums.freebsd.org/showthread.php?t=13003
http://forums.freebsd.org/showthread.php?s=225ae9995a8f20de4d3fbcad41ae2de3&t=1488
http://forums.freebsd.org/showthread.php?t=17961
https://github.com/freebsd/freebsd-ports/tree/master/net-p2p/amule
http://forums.nas4free.org/viewtopic.php?f=79&t=2358
https://forums.freebsd.org/threads/pkg-1-3-7-1-3-8-on-freebsd-9.48185/

To start, add a new jail (plugin jails turned to be the best solution). Keep the default values and name it as you like it (something meaningful as "aMule" may do). Note the IP assigned, as you'll have to use to access the aMule web interface later on. Here, we will assume it to be 192.168.1.3

I would also suggest to assign right away to the jail some external shared storage area to accomodate aMule "temp" and "incoming" directory, so to be able to easily access them from some other LAN clients (i.e. on a Windows share).
To do so, create a directory (you may name it "aMule-disk") containing the two subdirectories "incoming" and "temp" on one of your shared elements. On the FreeNAS web interface click on "Jails", highlight your aMule jail, click on the shell button that appears below and make a mount point for the directory you just created:
Code:
cd /mnt
mkdir aMule-disk 

Close the shell, click on the "add storage" button and assign the directory you just created on the share to the mount point you made.

Now, although to install aMule in your jail you may choose between packages or ports method, I'll just cover the latter, as I wasn't able to successfully deploy it through the former (NOTE: the ports method also turned out to be, in a way, flawed, due to some bugged dependencies).
Open once again the aMule jail shell and create the aMule home folder:
Code:
cd /
mkdir home
mkdir /home/aMule
mkdir /home/aMule/.aMule

Fetch and extract the ports:
Code:
portsnap fetch
portsnap extract

then (NOTE: these are additional step required by the fact that, as I mentioned, the ports dependencies are currently a bit buggy. As they will eventually get fixed in future updates/patches, these lines may no longer be needed):
Code:
cd /usr/ports/ports-mgmt/pkg
make deinstall reinstall
cd /usr/ports/devel/libffi/
make install clean

Now, it's time to fetch aMule:
Code:
cd /usr/ports/net-p2p/amule
make install clean

Depending on your internet connection and the speed of your machine, this will take from a long to a very long time, as the system will have to fetch and compile a lot of packages. When asked, accept the default options you are offered with.
Now, if all went well, you can configure aMule. First, you have to link the demon:
Code:
ln /usr/local/etc/rc.d/amuled /etc/rc.d/amuled

then you need to set it to start at jail startup, so open your rc.conf (NOTE: "ee" is a very easy to use text editor that comes bundled with your jails):
Code:
ee /etc/rc.conf

and add this line:
Code:
amuled_enable="YES"

Close and save. Now you need to create the aMule config file, which, among other things, will contain the MD5 hash of the password to be used for the web interface. So, it's now time to choose a password, (here we'll just use... the word "password" as password, but you may want to use a better one) and hash it:
Code:
echo -n password | md5

Copy the hashed value ( in the example will be 5f4dcc3b5aa765d61d8327deb882cf99) and store it for later use. It's now time to create/edit the aMule config file:
Code:
ee /home/aMule/.aMule/amule.conf

Here's a sample file (NOTE: some entries, such as incoming and temp folder location and password hashes, have been set according to the ones used in this example. In any case the file can be freely edited according to personal taste/needs):
Code:
[eMule]
AppVersion=2.3.1
Nick=http://www.aMule.org
QueueSizePref=50
MaxUpload=0
MaxDownload=0
SlotAllocation=2
Port=4662
UDPPort=4672
UDPEnable=1
Address=
Autoconnect=1
MaxSourcesPerFile=300
MaxConnections=500
MaxConnectionsPerFiveSeconds=20
RemoveDeadServer=1
DeadServerRetry=3
ServerKeepAliveTimeout=0
Reconnect=1
Scoresystem=1
Serverlist=0
AddServerListFromServer=1
AddServerListFromClient=0
SafeServerConnect=0
AutoConnectStaticOnly=0
UPnPEnabled=0
UPnPTCPPort=50000
SmartIdCheck=1
ConnectToKad=1
ConnectToED2K=1
TempDir=/mnt/aMule-disk/temp
IncomingDir=/mnt/aMule-disk/incoming
ICH=1
AICHTrust=0
CheckDiskspace=1
MinFreeDiskSpace=1
AddNewFilesPaused=0
PreviewPrio=0
ManualHighPrio=0
StartNextFile=0
StartNextFileSameCat=0
StartNextFileAlpha=0
FileBufferSizePref=16
DAPPref=1
UAPPref=1
AllocateFullFile=0
OSDirectory=/home/aMule/.aMule/
OnlineSignature=0
OnlineSignatureUpdate=5
EnableTrayIcon=0
MinToTray=0
ConfirmExit=1
StartupMinimized=0
3DDepth=10
ToolTipDelay=1
ShowOverhead=0
ShowInfoOnCatTabs=1
VerticalToolbar=0
GeoIPEnabled=0
ShowVersionOnTitle=0
VideoPlayer=
StatGraphsInterval=3
statsInterval=30
DownloadCapacity=300
UploadCapacity=100
StatsAverageMinutes=5
VariousStatisticsMaxValue=100
SeeShare=2
FilterLanIPs=1
ParanoidFiltering=1
IPFilterAutoLoad=1
IPFilterURL=
FilterLevel=127
IPFilterSystem=0
FilterMessages=1
FilterAllMessages=0
MessagesFromFriendsOnly=0
MessageFromValidSourcesOnly=1
FilterWordMessages=0
MessageFilter=
ShowMessagesInLog=1
FilterComments=0
CommentFilter=
ShareHiddenFiles=1
AutoSortDownloads=0
NewVersionCheck=1
AdvancedSpamFilter=1
MessageUseCaptchas=1
Language=
SplitterbarPosition=75
YourHostname=
DateTimeFormat=%A, %x, %X
AllcatType=0
ShowAllNotCats=0
SmartIdState=1
DropSlowSources=0
KadNodesUrl=
Ed2kServersUrl=
ShowRatesOnTitle=0
GeoLiteCountryUpdateUrl=http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
StatsServerName=Shorty's ED2K stats
StatsServerURL=http://ed2k.shortypower.dyndns.org/?hash=
VerboseDebug=0
[Browser]
OpenPageInTab=1
CustomBrowserString=
[Proxy]
ProxyEnableProxy=0
ProxyType=0
ProxyName=
ProxyPort=1080
ProxyEnablePassword=0
ProxyUser=
ProxyPassword=
[ExternalConnect]
UseSrcSeeds=0
AcceptExternalConnections=1
ECAddress=
ECPort=4712
ECPassword=5f4dcc3b5aa765d61d8327deb882cf99
UPnPECEnabled=0
ShowProgressBar=1
ShowPercent=1
UseSecIdent=1
IpFilterClients=1
IpFilterServers=1
TransmitOnlyUploadingClients=0
[WebServer]
Enabled=1
Password=5f4dcc3b5aa765d61d8327deb882cf99
PasswordLow=
Port=4711
WebUPnPTCPPort=50001
UPnPWebServerEnabled=0
UseGzip=1
UseLowRightsUser=0
PageRefreshTime=120
Template=no options available
Path=amuleweb
[GUI]
HideOnClose=0
[Razor_Preferences]
FastED2KLinksHandler=1
[SkinGUIOptions]
Skin=
[Statistics]
MaxClientVersions=0
[Obfuscation]
IsClientCryptLayerSupported=1
IsCryptLayerRequested=1
IsClientCryptLayerRequired=0
CryptoPaddingLenght=254
CryptoKadUDPKey=
[PowerManagement]
PreventSleepWhileDownloading=0
[UserEvents]
[UserEvents/DownloadCompleted]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/NewChatSession]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/OutOfDiskSpace]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/ErrorOnCompletion]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[HTTPDownload]
URL_1=http://upd.emule-security.org/ipfilter.zip
URL_4=http://amule.sourceforge.net/lastversion
[Debug]
Cat_General=0
Cat_Hasher=0
Cat_ED2k\ Client=0
Cat_Local\ Client\ Protocol=0
Cat_Remote\ Client\ Protocol=0
Cat_Packet\ Parsing\ Errors=0
Cat_CFile=0
Cat_FileIO=0
Cat_ZLib=0
Cat_AICH-Hasher=0
Cat_AICH-Transfer=0
Cat_AICH-Recovery=0
Cat_ListenSocket=0
Cat_Credits=0
Cat_ClientUDPSocket=0
Cat_DownloadQueue=0
Cat_IPFilter=0
Cat_KnownFileList=0
Cat_PartFiles=0
Cat_SHAHashSet=0
Cat_Servers=0
Cat_Proxy=0
Cat_Searching=0
Cat_ServerUDP=0
Cat_Client\ Kademlia\ UDP=0
Cat_Kademlia\ Search=0
Cat_Kademlia\ Routing=0
Cat_Kademlia\ Indexing=0
Cat_Kademlia\ Main\ Thread=0
Cat_Kademlia\ Preferences=0
Cat_PartFileConvert=0
Cat_MuleUDPSocket=0
Cat_ThreadScheduler=0
Cat_Universal\ Plug\ and\ Play=0
Cat_Kademlia\ UDP\ Firewall\ Tester=0
Cat_Kademlia\ Packet\ Tracking=0
Cat_Kademlia\ Entry\ Tracking=0
Cat_External\ Connect=0
Cat_HTTP=0

Next you need to add the user aMule and to assign it ownership of its home folder . Just make sure that all folder contents gets assigned accordingly, otherwise you won't be able to start the demon later on:
Code:
pw groupadd aMule
pw useradd aMule -g aMule -s /bin/sh -c "aMule Daemon" -d /home/aMule
chown -R aMule:wheel /home/aMule

Finally, you can start aMule for the first time:
Code:
/etc/rc.d/amuled start

and check it at the address http://192.168.1.5:4711 (if the IP of your jail happens to be the same used in my example...otherwise change it accordingly).
As a final touch, you can remote control and configure your aMule from a Windows environment using aMuleGUI , which you can find as part of the aMule download at:

https://sourceforge.net/projects/amule/files/aMule/2.3.1/aMule_2.3.1 - Win32.zip/download

Just run aMuleGUI and connect it to your remote jail using the jail IP, the port 4712 and the password you chose.

Hope someone finds this useful...
Please let me know of any mistake you find or if you know a better way of doing it.
 

fede91it

Cadet
Joined
Jun 16, 2018
Messages
1
Thank you for your guide!

I'm wondering, but if you can install eMule this way, maybe you can also build an official plugin for FreeNAS?
 
Status
Not open for further replies.
Top