Direct Connect

From PlugWiki
Jump to: navigation, search

>== Server (opendchub) ==

Contents

Installation

Type <pre>apt-get install opendchub</pre>

Or build the sources yourself:

  1. Download http://opendchub.sourceforge.net/ and put it on your plug.
  2. You need to compile so if you don't have it already:<pre>apt-get install gcc automake make libperl-dev</pre>
  3. Goto the directory where you un-tarred the file and type: <pre>./configure</pre>
  4. After the configuration utility finishes, type <pre>make</pre>
  5. Type <pre>make install</pre> The hub installs itself at /usr/local/bin/opendchub

Now the hub is installed.

Configuration

The configuration files are at /root/.opendchub. Lets open the config file (vi /root/.opendchub/config), and tweak the settings. I would strongly suggest...

  1. Changing the name of the hub to something clever, like plughub
  2. Changing the description of the hub to something witty
  3. Setting the listening_port to anything (above 1000 just for the "why not" of it)
  4. Hublist_upload = 0 - you don't want to advertise this to the world
  5. Public_hub_host = "none" - just in case the previous setting was ignored.
  6. Hub hostname- the IP address of the plug. I would recommend getting something through dyndns if you have a dynamic IP.

Configuration done! Run the hub with the following command <pre>opendchub -v</pre>

Hopefully you will see: <pre>Hub is up and running. Listening for user connections on port ?? and listening for admin connections on port ??</pre>

If that worked, you can add "opendchub" to your /etc/rc.local file so that it starts up with your plug. The -v prints out messages to the terminal you are in. Run it that way whenever you are debugging.


Client (microdc2)

Now that you have a hub, join it! You need the hub for everyone, and then to join it with a client so you can share the files that are on your external drive attached to the plug. We will be using microdc2.

Installation

  1. Download files from http://corsair626.no-ip.org/microdc/ and put it on your plug.
  2. You need some more packages, so
    apt-get install libreadline5 libreadline5-dev libxml2-dev 
  3. There is a bug in the configuration file. Fire up your favorite text editor, and open the configure file. Change line #21511 from
    if test $LIBXML2_VERSION -ge 2616; then 
    to
    if test $LIBXML2_VERSION > 2616; then 
  4. Build the code
    ./configure
    make
  5. Install the program
    make install

Installation complete! You can now run the program by typing microdc2 (but don't, you still have more work ahead of you).

Configuration File

While a configuration file is not needed with this program, if you don't have one, you will have to type in the settings every time. The configuration file needs to be in the microdc2 directory. The file won't exist at first, create it.

vi /root/.microdc2/config

Add the following lines to the config file:

  • Be sure your router forwards this port to the plug.
set listenport xxx
  • Needed if you have a firewall. Also needs to be AFTER you pick the port or else it will pick a random one.
set active 1
  • Needs to be your external IP. Visit whatismyip.org to find this. This can not be a dynamic hostname.
set listenaddr xxx.xxx.xxx.xx
  • Add some other miscelaneous lines
set auto_reconnect on
set log_charset UTF-8
set logfile /root/.microdc2/log
set nick xxx 
set description "Just a plugcomp, sitting in a box."
set downloaddir /root/downloads/
set speed 10
set slots 2
  • Finally connect to the hub you want. Dynamic hostnames are okay for this field.
connect mydchub:xxxx

Running for the first time (setting up shares)

The first time you run microdc2 you need to setup shares. These are the only things that persist through restarts without the config. This n switch ensures you arent using the config file you just made (sorry, soon!)

microdc2 -n

Now that you are in the program, share some folders.

share /mnt/external/folder1
share /mnt/external/folder2

It is important to note that the files will be added almost immediately. On a hub, you will see these sharesizes, but you will not be able to get to the files until they are hashed. They are VERY SLOWLY hashed in the background. Just leave the microdc2 window open and it will gradually work in the background. If you want to see how the program is doing check:

status

This will tell you the most recently hashed file. Once some are hashed you should be good to go. All of the shared folders will be there whenever you come back.

Normal Running

Just type microdc2. You will be in the dc++ shell. Type "help" for a list of commands, and / or follow information at the creator's website to learn to use it. I just use it as a fileserver, and use another windows computer to do my downloading. This is just used for uploading.

You type exit to exit the shell and that also exits the hub.

Running in the Background

The shell is great and all but you probably want it to run in the background and not bother you. To do this, we are going to use screen. If you don't already have it,

apt-get install screen

Now then, instead of typing microdc2, type:

screen
microdc2

Ta-da! You're essentially done! If you don't believe me, open another SSH session, and type

screen -ls

You should see the screen on the other computer.

If you are disconnected from that first SSH session, you can open another SSH, and get the screen information from screen -ls, then type the following (where that last part is the part you saw in the screen -ls command):

screen -r  2888.pts-0.plugcomp

If you are currently at the microdc2 shell, you can break out of it by typing <CTRL-a>+<d>. You can resume from it as outlined above.

Here http://www.rackaid.com/resources/linux-tutorials/general-tutorials/using-screen/ is a good tutorial about screen in case you want to find out more information about it.

Enjoy, and good luck!

Personal tools