Creating a Software Raid Array on Debian in 600 seconds…

January 20th, 2010

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.

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.

Linux itunes server with Debian in 600 seconds…

January 19th, 2010

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.

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 in Apache with Debian in 600 seconds…

January 18th, 2010

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.

1. Install apache2 package/software.

# aptitude 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 webmaster@example.com
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

Been a while…

January 12th, 2010

Its been a while since my last blog post. Well as usual with most people, life has taken over during. I will be blogging now a lot more on how to setup applications withing Linux. This was due to a serious disk failure, and not backing up my data for a while. I have decided to document how I setup the applications. I will not go into serious detail, on how every switch work. There are enough websites that can tell you this. I will be more the how to get you app running, as quickly as possible. Hopefully I can work, on how to get most apps working in ten minutes or less.

Increasing Gallery2 upload size limit…

December 18th, 2008

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

Mounting Smb Shares in Mac OS X…

December 13th, 2008

To quickly mount a network share. As in a samba or windows share. Open a terminal and type:

# mount -t smbfs //user@server/sharename share

The mounted directory can be found in the finder application under the shared machines.

To have the machine share show as a icon on the desktop, you need a create a share directory within the root directory on your disk.

Macbook Pro Saga…

December 13th, 2008

Well it seems that the western digital hard disk saga for the macbook will not arrive for several weeks. So instead i recieved a seagate 320gb 7200rpm 2.5″ laptop hard disk. Now it is time to time machine the hard disk, and restore the conents from the tme machine disk to the new large insternal storage unit.

I have allocated a old 200gb hard disk, split into two 100gb partitions. The first partition is the time machine partition for backing up the internal macbook pro hard disk. The second partition I have allocated as a file repositorie for mac software.

So far I have no issues with the Macbook Pro. I just need to get myself more proficient with Mac OS X.

Macbook Pro Day Five…

November 21st, 2008

Well Day five of the Macbook Pro saga. No larger internal storage has turned up yet. I decided to install applications upon the Macbook Pro, and start using the machine. The first thing I have done is setup another external hard disk as a time machine backup disk. I find that the usb hard disk unit is slow, and have decided to purchase a firewire hard disk unit.

Lets see how monday goes.

Macbook Pro Day Four…

November 20th, 2008

Well day four, of the macbook pro saga. With no larger internal storage available, I decided to install Mac OSX Leopard, and will time machine the disk. When I do the re-install on the new hard disk, I will hopefully do a time machine install, when the new installation happens on the disk.

Hoping tomorrow, the internal storage will arrive tomorrow.

Macbook Pro Day Three…

November 20th, 2008

Well today, things are definitely looking better, I have been able to acquire a operating system, but not larger internal storage.