September 9, 2010 · Server · Email This Post

Sponsored Link
MirrorBrain is an open source framework to run a content delivery network using mirror servers. It solves a challenge that many popular open source projects face -- a flood of download requests, often magnitudes more than a single site could practically handle.
A central (and probably the most obvious) part is a "download redirector" which automatically redirects requests from web browsers or download programs to a mirror server near them.

Choosing a suitable mirror for a users request is the key, and MirrorBrain uses geolocation and global routing data to make a sensible choice, and achieve load-balancing for the mirrors at the same time. The used algorithm is both sophisticated and easy to control and tune. In addition, MirrorBrain monitors mirrors, scans them for files, generates mirror lists, and more.

Install mirror brain in ubuntu

First you need to make sure you have install Ubuntu LAMP server once you have this you need to Add package repository

edit /etc/apt/sources.list file

sudo vi /etc/apt/sources.list

Add one of the following

For ubuntu 10.04 users add the following line

deb http://download.opensuse.org/repositories/Apache:/MirrorBrain/Ubuntu_10.04/ /

For ubuntu 9.10 users add the following line

deb http://download.opensuse.org/repositories/Apache:/MirrorBrain/xUbuntu_9.10/ /

Save and exit the file

Install GPG key

sudo apt-key adv --keyserver hkp://wwwkeys.de.pgp.net --recv-keys BD6D129A

Update source list

sudo apt-get update

Install the MirrorBrain packages using the following command

sudo apt-get install mirrorbrain mirrorbrain-tools mirrorbrain-scanner libapache2-mod-mirrorbrain libapache2-mod-autoindex-mb

install an Apache MPM

sudo apt-get install apache2-mpm-worker

Note :- If the LAMP server has been installed, the prefork MPM was probably preselected. It may make sense to switch to the worker MPM in such cases, which is a good choice for busy download servers. If something like PHP is in use as embedded interpreter (mod_php), though, then you need to stick to the prefork MPM, because libraries that are used by PHP might not be threadsafe.

Configure mod_geoip

mod_geoip is configured to look for the GeoIP data set in /var/lib/GeoIP. You need to download the GeoIP data set. We chose the larger “city” dataset:

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz

gunzip GeoIP.dat.gz

sudo mkdir /var/lib/GeoIP

sudo cp GeoIP.dat /var/lib/GeoIP/GeoIP.dat

Configure mod_dbd

With Ubuntu 10.04, the DBD (Apache Portable Runtime DBD Framework) database adapter for PostgreSQL is already installed, because the driver is statically linked into the libaprutil1 shared object. libaprutil1-dbd-pgsql is a virtual package which is just a pointer to the libaprutil1 package.

Running the following snippet will create a configuration for mod_dbd:

sudo sh -c "cat > /etc/apache2/mods-available/dbd.conf << EOF
<IfModule mod_dbd.c>
DBDriver pgsql
DBDParams ‘host=localhost user=mirrorbrain password=12345 dbname=mirrorbrain connect_timeout=15′
</IfModule>
EOF
"

Note:-Edit the password in the template here – take note of it, you’ll need it below, when you create a database user account.

Install PostgreSQL

Install the PostgreSQL server (here, version 8.4 is the current version):

sudo apt-get install postgresql-8.4

Create the postgresql user account and database

Switch to user postgres:

sudo su -- postgres

Create user:

createuser -P mirrorbrain
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n

Create database:

createdb -O mirrorbrain mirrorbrain
createlang plpgsql mirrorbrain

Exit user postgres:

exit

Edit host-based authentication

Add line host mirrorbrain mirrorbrain 127.0.0.1/32 md5 to the end of pg_hba.conf, which is to be found here:

sudo vim /etc/postgresql/8.4/main/pg_hba.conf

Start the PostgreSQL server:

sudo /etc/init.d/postgresql-8.4 restart

Create needed users and groups

Create user and group mirrorbrain:

sudo groupadd -r mirrorbrain
sudo useradd -r -m -g mirrorbrain -s /bin/bash -c "MirrorBrain user" -d /home/mirrorbrain mirrorbrain

Import initial mirrorbrain data

Import structure and data, running the commands as user mirrorbrain:

sudo su -- mirrorbrain
gunzip -c /usr/share/doc/mirrorbrain/sql/schema-postgresql.sql.gz | psql -U mirrorbrain mirrorbrain
gunzip -c /usr/share/doc/mirrorbrain/sql/initialdata-postgresql.sql.gz | psql -U mirrorbrain mirrorbrain
exit

Create needed directories

Create the following directory for logs, and give ownership to the new mirrorbrain user:

sudo mkdir /var/log/mirrorbrain
sudo chown mirrorbrain:mirrorbrain /var/log/mirrorbrain
sudo chmod 0750 /var/log/mirrorbrain

Once this installation completed you need to follow mirrorbrain configuration steps

Sponsored Link

Incoming search terms:

Related posts

Leave a Reply