Creating a Software Raid Array in 600 seconds…

Recently I decided that I was going to build a array, after my disk failure on my previous server. This would allow my data to be redundant, even with a disk failure. I debated between hardware and software raid. Hardware raid would be faster, limited to one hardware controller. While with software raid or sometimes called fake raid. I can have the disks across multiple controllers. This again slows the performance of the software raid, but it is the tradeoff, I am willing to accept. I decided on software raid because, if a disk dies, and I cannot get a the same size. I can use a larger disk, and downsize the disk to the size of the other disks in the array.  Also with technology, larger disks do come down in price.

Ubuntu:

1. We need to first install the the raid software.

# apt-get install mdadm

2. Create the partitions on the hard disks.

# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa3e937ed
Device Boot Start End Blocks Id System
/dev/sda1 1 60801 488384001 fd Linux raid autodetect

Next we need to change the partition type to “Linux raid auto”.

Command (m for help): t
Selected partition 1
fd  Linux raid auto
Hex code (type L to list codes): fd

3. Create the software raid array.

# mdadm –create /dev/md0 –chunk=4 –level=5 –raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1

–create creates the software array.
/dev/md0 is the name of the array, the array needs to be md[number]
–chunk the block size of the software array.
–raid-devices how many disks in the array.
/dev/sda1 is the disks that will be included in the array

4. Assemble the software raid array.

# mdadm –assemble /dev/md0 /dev/sda1 /dev/sdb1 /dev/sdc1

–assemble bundle the disks together.
/dev/md0 the name of the array.
/dev/sda1 the disks in the array.

5. To see the software raid sync you can use the following command.

# watch -n 10 cat /proc/mdstat

When the array is sync’ed it will have 100%. Time it takes depends on the size of the software array.

6. Create the file System upon the software array. You can partition the software array with fdisk.

# mkfs.ext3 /dev/md0

7. Now you can use the software disk array.

Itunes server in 600 seconds…

For the last few weeks I have been getting fustrated trying to access my music from my powermac and macbook pro to my ubuntu linux laptop. After some research via google, I found that linux had several itunes compatiable software that will run under linux. I decided on firefly media server Firefly media server is available for all flavours of unix, and had the most development and user base installed. Under Debian firefly had a package that I could just install, then just run the web interface. Here is the sequence of how I setup the itunes music server.

Ubuntu:
1. Install the itunes music server software

# apt-get install mt-daapd

2. Lets configure the mt-daapd configuration file.

# cd /etc

# vi mt-daapd.conf

The parts I edited are the location of where the music files are located.

mp3_dir = /storage/music

I also changed the password of the login.

admin_pw = mt-daapd

3. Now we need to restart the firefly server so the changes we made to the configuration file take effect.

# /etc/init.d/mt-daapd restart

4. Your can log into the web interface of the firefly music server. The location url will be http://machine:3689, enter your username and password. You can change any settings instead of editing your mt-daapd.conf on your server. 5. Within your supported application the itunes server with your music stored should now show up. If you have any issues make you can ping port 3689 of the server firefly is installed upon. Also check your firewall software. Now go ahead and enjoy streaming music across your network.

Creating a WebDav Server in Apache in 600 seconds…

Recently I started doing more web development, and decided instead of developing, my web ideas locally upon my machine, I could create a webdav upon my machine using debian packages, no compiling etc. To create this system, took me about 600 seconds in total. This is the sequence I took to create the webdav system.

Ubuntu:

1. Install apache2 package/software.

# apt-get install apache2

2. Activate the webdav modules within apache2.

# a2enmod dav_fs
# a2enmod dav

Now lets edit your apache default configuration. You can use a different virtualhost if you choose. I choose the default since my development server was upon a vmware instance. I built the instance just for web development work.

3. Go to the default configuration file of your apache2 for to modify for webdav usauge.

# cd /etc/apache2/sites-available

4. Now lets edit the configuration file.

# vi default

5. Edit your configuration file to reflect like mine below.

<VirtualHost *>
ServerAdmin [email protected]
ServerName www.example.com
DocumentRoot /var/www
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/dev_error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/machine.log combined
Alias /var/www
<Location /var/www>
DAV On
AuthType basic
AuthName “development”
AuthUserFile /var/www.passwd.dav
Require valid-user
</Location>
</VirtualHost>

Lets explain the parts of the configuration you need to know.

DocumentRoot /var/www

This is the top level directory where your web files reside.

<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

This is the how this directory configuration, change if your need more, I left mine default.

Alias /share /var/www

This line above tells me if I want the call /var/www /dev/ upon my browser or application like dreamweaver etc. e.g. http://www.example.com/share

DocumentRoot /var/www

The about lines sets up the level of security. Since my server is a internal server only, I only used basic security.

<Location /var/www>
DAV On
AuthType Basic
AuthName “development”
AuthUserFile /var/www.passwd.dav
Require valid-user
</Location>

6. Next step is to create the password file that our users and there password is located.

# htpasswd -c /var/www/passwd.dav admin

You need to enter the password for the user, when the above command is entered.

7. We need to change the permissions of the passwd.dav file

# chown root:www-data /var/www/passwd.dav
# chmod 640 /var/www/webdav/passwd.dav

8. Now restart the apache2 webserver application.

# /etc/init.d/apache2 restart

9. Testing the application can be done via the application cadaver. We need to first get the

# apt-get install cadaver

Increasing Gallery2 upload size limit…

If you are using Gallery2 and you get a error stating the upload size limit being too large. This is not a Gallery2 limitation but a php limitation.

To modify the limitation limit of two megabyte to e.g. ten megabyte limit is as simple as just changing the php.ini file.

The administrator just needs to change the two variables in the php.ini file.

Under debian the php.ini file is located in the following area

# cd /etc/php5/apache2/

# vi php.ini

The following variables need to be changed post_max_size and upload_max_filesize.

Change the values to the following

post_max_size 10M
upload_max_filesize 10M

Also remember to restart apache2 for the changes to take effect.

The following command is needed to restart apache.

# /etc/init.d/apache2 restart

Install Vmware tools upon Debian…

To Install Vmware tools upon a debian etch instance. It is not a hard process. Here is the step by step process to install the vmware tools upon a debian installation.

Install some required packages upon the installed machine.

# apt-get install autoconf automake binutils cpp gcc linux-headers-$(uname -r) make psmisc

Mount the vmware iso image

# mount /dev/cdrom /media/cdrom

Copy the vmware tools to the temporary folder

# cp /media/cdrom/VMwareTools-1.0.3-44356.tar.gz /tmp

Go to the temporary folder

# cd /tmp

Unpack the VMware archive distribution.

# tar -xvfz VMwareTools-1.0.3-44356.tar.gz

get into the unpacked directory

# cd vmware-tools-distrib

execute the installer

# ./vmware-installer.pl

once a machine has rebooted, if you have x windows installed upon your system, or from a remote x desktop.

# vmware-toolbox &