Microdc2 debian

Hi everyone.

I noticed there were no tutorials on the forums explaining how to do this, so I'll go through the steps I used to make this work here.


Microdc2 is an excellent command line based directconnect client, just like dc++ for windows, linuxdc++ for linux or shakespeer for mac. Now linuxdc++ is a very nice, fairly stable (later versions anyway) full featured client, so you might think why would you need something else.

Answer: Command line apps are great because

a) They take very little resources so you can run them as server daemons on older hardware
b) You can control them from anywhere in the world over an ssh connection
c) They are generally much much more stable and reliable than their graphical counterpart.
d) They're often (but not always) more configurable than their graphical alternatives.

This makes them excellent for things like running as daemons on unattended servers.

There are only two command line direct connect clients for linux. Microdc2 is one, and another one is nanodc. Nanodc appears to be under heavy development, whereas I think microdc2 may be stagnant now (correct me if I'm wrong here!). However, nanodc seems to be in pretty early beta from what I could see and although it uses a prettier ncurses interface that microdc2, its not actually as easy to use. Maybe in a little while nanodc will be a better choice, but for now, microdc2 is much better in my opinion.


First you need to download the source tarball. Go to the microdc2 website and download the latest version of the tarball. When I downloaded it, it was version 15.6, available here. So go into a command line, change to a suitable directory and download/unzip the tarball:

cd ~
mkdir microdc2
cd microdc2
wget http://corsair626.no-ip.org/microdc/microdc2-0.15.6.tar.gz
tar xvfz microdc2-0.15.6.tar.gz
cd microdc2-0.15.6

Ok, there's the source, but before we can compile it we need to download some libraries that the program needs:

sudo aptitude install build-essential libreadline5-dev checkinstall libxml2-dev libbz2-dev
Now you can start making the program. I like to use checkinstall instead of make install because it installs the program as a normal debian package so you can easily remove it later.

sudo checkinstall

Checkinstall will ask you some questions. You don't actually have to answer any of them, just say 'y' and press enter and it will automatically create a set of package docs for you.

Ok, now microdc2 is installed! If you used the default set of package docs in checkinstall, it will be called microdc2 in synaptic, and you can treat it like a normal package.


You can start microdc2 by just typing

at the command line. As with most command line applications, it looks a bit empty and threatening at first, but don't worry! It really is extremely easy to use:

user@users-pc:~$ microdc2
Loading local FileList...done
Sharing 0 bytes (0B) totally

You can type help and press enter to get a list of commands, or type help and then a command to get detailed information about what the command does.

microdc2> help
alias [NAME[=VALUE] ...] browse [USER]
connect HOST[:PORT] disconnect
exit find [FILE ...]
get FILE ... grantslot [USER ...]
help [COMMAND ...] lookup HOST ...
ls [OPTION...] [FILE...] msg USER MESSAGE...
pwd queue [USER ...]
raw DATA... results [INDEX ...]
retry USER ... say MESSAGE...
search WORD... set [NAME [VALUE...]]
share DIR shell [COMMAND [ARGUMENTS...]]
status transfers
unalias NAME ... unqueue USER [RANGE]
unsearch INDEX ... unshare DIR
who [USER ...] 
microdc2> help set
set: set [NAME [VALUE...]]

Without arguments, display a list of variables and their current values. With only NAME argument, display the
value of that variable. With NAME and VALUE arguments, change the value of a variable.

Microdc2 also supports tab completion so you press tab to finish commands or just press tab at an empty prompt to get help.

Ok, microdc2 is pretty useless at the moment, so let's tell it to connect to a hub:

microdc2> connect xxx.xxx.xxx.xxx:pppp
You should put in the ip address and port of the hub you would like to connect to. You can chat to people by doing:

microdc2> say This is a message broadcast to everyone
You can share files by doing this:

microdc2> share /home/user/sharedfiles/
Remember, microdc2 supports tab completion so it's very quick to use. These files will be instantly shared, but microdc2 will start hashing them in the background as a low priority task.

Now here's something important:

Microdc2 ONLY remembers shared directories. All other settings are forgotten on shutdown.

This is why you have to create a ~/.microdc2/config file with all the commands you would like microdc2 to execute on startup. So create and open this file in your favourite editor. I will use gedit it here:

cd ~/.microdc2
gedit config

I have made an example config file here, you can change the settings to whatever you would like microdc2 to do:

# You should make sure that this listen port is forwarded properly if you are behind a router. If you can't forward ports, set active off and use passive mode. This can work behind firewalls but is crippled and slower than a properly forwarded one. NOTE: the port MUST be set before active mode is set on.
set listenport xxxx
set active on

# The following address should be set to your EXTERNAL ip address. This can be found by visiting www.whatismyip.com.
set listenaddr xxx.xxx.xxx.xxx

# I like to turn autoreconnect on in case I get disconnected from the server for whatever reason.
set auto_reconnect on

# The following enables logging. Replace the logfile with wherever you want it to log to. You can of course turn it off by leaving the following two lines blank
set log_charset UTF-8
set logfile /home/user/.microdc2/log

# These should all be pretty self-explanatory. Nick is your nickname. If the hub requires a password, specify one here.
set description I'm using microdc2!
set email microdc2user@example.com
set nick microdc2user
set password xxxx
set downloaddir /home/user/Microdc2_downloads/

# The set speed option doesn't actually change anything, it only changes your REPORTED speed that other users see. The slot is how many simultaneous downloads people can get from you.
set speed somerandomstring
set slots 2

#This is the hub connect command, it should be left until last
connect xxx.xxx.xxx.xxx:pppp
Of course there a lot more options than these, but this should get you started. That's it if you want to leave it there and just run microdc2 normally!

Running as a daemon

apt-get install screen

# Start/stop/restart the services for MicroDC.

microdc_start() {
if [ -x /usr/local/bin/microdc2 ]; then
echo "Starting MicroDC"
/usr/bin/screen -d -m /usr/local/bin/microdc2
microdc_stop() {
echo "Stoping MicroDC"
kill -9 `pidof SCREEN`
screen -wipe
microdc_restart() {
kill -9 `pidof SCREEN`
screen -wipe
sleep 2
/usr/bin/screen -d -m /usr/local/bin/microdc2

case "$1" in
# Default is "start", for backwards compatibility with previous
echo "start|stop|restart"



Based on article written by Sam

Комментариев нет: