Skip to content

All In Tech

Providing IT Tutorials, Scripts, and Much More!!

Archive

Category: Linux

This is the setup process I follow to setup a DC++ Hub, which I use for Adam Internet’s Community Net.

I use DBHub (http://www.dbhub.org/) for the Hub software.

The system this process works on:
Linux Ubuntu 2.6.28-11-generic (mythubuntu)
Perl v5.10.0

I have included a modified configure file because as of Perl 5.10 DynaLoader is no longer in DynaLoader.a but is now included in libperl.a.

*So if you receive an error like (DynaLoader.a not found, then use my modified configure file).

First install the needed dependencies:

sudo apt-get install build-essential libperl-dev

Download the needed files:

wget http://internode.dl.sourceforge.net/project/dbhub/DB%20Hub/0.451/dbhub-0.451.tgz
wget http://allintech.info/wp-content/uploads/dbhub/configure-0.451

Run the following commands to configure and compile DBHub with Perl scripting support

tar -zxf dbhub-0.451.tgz
cd dbhub-0.451
cp ../configure-0.451 configure
./configure --enable-perl
make
make install

when you first run dbhub it will setup the config file, so make sure you ran it as the user you want to run the hub. i.e if I use the root user to run the command then the config will be stored in /root/.dbhub

/usr/local/bin/dbhub

Enter in a port to listen on (411)
Set a Username and Password for the owner user

DBHub will now be running and listening for connections.

2 people like this post.

Here is a quick and dirty tutorial for writing data and setting fuse bits on an AVR microcontroler using Ubuntu. All details in this post are related to the Atmega8-16PU, for other versions you should relate to the data sheets for the relevant specifications. First we need to get the necessary development tools:

# sudo  apt-get install gcc-avr avr-libc gdb-avr avrdude

Now we need to create a cable to go between the LPT port on your PC and the AVR micro-controller:

DB25 Male AVR
Pin 1 SCK
Pin 2 MOSI
Pin 11 MISO
Pin 16 RESET
Pin 21 GND

*Warning: The data pins (1,2) should have a 1k resister in line, this is to stop you from killing either your LPT port, AVR, or both. It will work without just make sure you have it wired 100% correct. d9-f1 atmega8-1 Run the following to test the connection:

# sudo avrdude -p m8 -P /dev/parport0 -c dapa

You should receive back:

avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9307
avrdude: safemode: Fuses OK
avrdude done.  Thank you.

If you receive:

avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

Then something is wrong and you should check all your connections. Now to Test out some code you can try this example:

/*
 * blink.c
 */

#include <avr/io.h>
#include <util/delay.h>
#define LED PD4

int main(void) {
  // define pd4 as output
  DDRD |= (1 << LED);
  while (1) {
    PORTD |= (1 << LED);    // switch on
    _delay_ms(1000);
    PORTD &= ~(1 << LED);    // switch off
    _delay_ms(1000);
  }
return 0;
}

Save as blink.c Now in the same directory save the following Makefile:

MCU=atmega8
AVRDUDEMCU=m8
CC=/usr/bin/avr-gcc
CFLAGS=-g -Os -Wall -mcall-prologues -mmcu=$(MCU)
OBJ2HEX=/usr/bin/avr-objcopy
AVRDUDE=/usr/bin/avrdude
TARGET=blink

program : $(TARGET).hex
	$(AVRDUDE) -p $(AVRDUDEMCU) -P /dev/parport0 -c dapa -U flash:w:$(TARGET).hex

%.obj : %.o
	$(CC) $(CFLAGS) $< -o $@

%.hex : %.obj
	$(OBJ2HEX) -R .eeprom -O ihex $< $@

clean :
	rm -f *.hex *.obj *.o

So now using the makefile we are going to create a .hex file of the c code above and write it onto our chip:

# sudo make

sucessful output:

/usr/bin/avr-gcc -g -Os -Wall -mcall-prologues -mmcu=atmega8   -c -o blink.o blink.c
/usr/bin/avr-gcc -g -Os -Wall -mcall-prologues -mmcu=atmega8 blink.o -o blink.obj
/usr/bin/avr-objcopy -R .eeprom -O ihex blink.obj blink.hex
/usr/bin/avrdude -p m8 -P /dev/parport0 -c dapa -U flash:w:blink.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9307
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "blink.hex"
avrdude: input file blink.hex auto detected as Intel Hex
avrdude: writing flash (138 bytes):
Writing | ################################################## | 100% 0.05s
avrdude: 138 bytes of flash written
avrdude: verifying flash memory against blink.hex:
avrdude: load data flash data from input file blink.hex:
avrdude: input file blink.hex auto detected as Intel Hex
avrdude: input file blink.hex contains 138 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.03s
avrdude: verifying ...
avrdude: 138 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done.  Thank you.

rm blink.obj blink.o

Attach a LED to PD4 with a resister in line and the LED should light up and flash. Written by: Jason Smith

3 people like this post.

Distributive computing has been around for a long time and there are many different ways of doing it. Today i will be looking at the Message Passing Interface (MPI) standard and will be using the MPICH2 sources provided from http://www.mcs.anl.gov/research/projects/mpich2/

On such a cluster you can run any application that has been designed for MPI, for some benchmarks i ran John The Ripper. (you can get the MPI version here: http://www.bindshell.net/tools/johntheripper/john-1.7.3.1-all-2-mpi8.tar.gz)

Results of the benchmark

No MPI:

Benchmarking: Traditional DES [128/128 BS SSE2]… DONE
Many salts: 1986K c/s real, 1982K c/s virtual

MPI (4 cores over 2 machines)

Benchmarking: Traditional DES [128/128 BS SSE2]… DONE
Many salts: 5151K c/s real, 5151K c/s virtual

As you can see its about a 3 fold improvement.

I have decided to go with Ubuntu for the base system as I’m most familiar with this distro.

Configure the Head Node:

Download the necessary packages

sudo apt-get install nfs-kernel-server openssh-server build-essential

Create the share for NFS

sudo mkdir /mirror
sudo mkdir /mirror/mpiu

run the following to add “/mirror *(rw,sync)” to /etc/exports

echo /mirror *(rw,sync) >> /etc/exports

restart NFS

sudo /etc/init.d/nfs-kernel-server restart

Create a user for the cluster

sudo useradd -d /mirror/mpiu
sudo passwd mpiu
su mpiu
sudo chown mpiu /mirror

Now we setup SSH

ssh-keygen -t dsa

*Don’t set a passphrase

Add the key to Authoirzed keys

cd ~/.ssh

cat id_dsa.pub >> authorized_keys

Download MPICH2

wget http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/1.0.7/mpich2-1.0.7.tar.gz

mkdir /mirror/mpich2

tar -xvf mpich2-1.0.7.tar.gz

cd mpich2-1.0.7

./configure --prefix=/mirror/mpich2

make

sudo make install

Now add the following lines to /mirror/mpiu/.bashrc

export PATH=/mirror/mpich2/bin:$PATH

export PATH

LD_LIBRARY_PATH="/mirror/mpich2/lib:$LD_LIBRARY_PATH"

export LD_LIBRARY_PATH

Now edit /etc/environment and add the following

/mirror/mpich2/bin

Add the hostnames of the machines which are in the cluster into ~/mpd.hosts (currently there will be none if this is your server)

And then run the following commands

 echo secretword=password >> ~/.mpd.conf
sudo chmod 600 ~/.mpd.conf

And there you go, a MPI server running on ubuntu 8.04

A Ubuntu MPI Cluster (PART 2 – client setup) (coming soon!)

7 people like this post.