Friday, June 13, 2008

Installing Slackware 12 on a software RAID device

This HOWTO assumes that you're going to perform a fresh installation of Slackware 12. So lets start :

In this howto, i install Slackware on 3 sofware RAID0 configurations using mdadm. One for /, one for /home and another one for /mnt/extras.

Boot up the Slackware DVD
and log in as root.

Use cfdisk to create the partitions on the harddrives :

The partitioning scheme for my 2 x 80GB SATA harddrives :

/dev/sda :
sda1 Primary Linux ext3 139.83
sda2 Primary Linux raid autodetect 5116.13
sda3 Primary Linux raid autodetect 59411.20
sda4 Primary Linux raid autodetect 15356.60


/dev/sdb :
sdb1 Primary Linux raid autodetect 5116.13
sdb2 Primary Linux raid autodetect 59411.20
sdb3 Primary Linux raid autodetect 15356.60

sda1 is a 140MB partition dedicated to hold the kernel image as well as the bootloader since no bootloader i know of can boot off a software RAID 0 array.

Build your arrays with Multiple Devices Admin (mdadm) program ( level=0 : Striped/RAID0, level=1 : Mirrorred/RAID1, level=4/5/6/10, man mdadm for more help on this )
  • mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sda2 /dev/sdb1 # for root
  • mdadm --create /dev/md1 --level=0 --raid-devices=2 /dev/sda3 /dev/sdb2 # for home
  • mdadm --create /dev/md2 --level=0 --raid-devices=2 /dev/sda4 /dev/sdb3 # for anything else ;)

Now fire up the installation as usual (# setup)
Now, when it comes to selecting partitions, pick /dev/md0 as the target for "/" (root)
As you progress in the installer, create the mountpoints :
  • "/home" for the device "/dev/md1"
  • "/boot" for the bootloader on "/dev/sda1"
  • "/mnt/extras" or anything else for "/dev/md2" [this step is optional]
Install everything as you normally would.
Now we mount Slackware (/dev/md0) and the boot partition and chroot into the system
  • mkdir /mnt/md0
  • mount /dev/md0 /mnt/md0
  • mount /dev/sda1 /mnt/md0/boot
  • chroot /dev/md0
Now we are in the OS installed on our software RAID array. Next we mount the Slackware DVD, install and setup GRUB (because i prefer GRUB to LILO ;)
  • mount /dev/cdrom /mnt/cdrom
  • cd /mnt/cdrom/extra/grub
  • installpkg grub*.tgz
  • grub-install --root-directory=/boot /dev/sda # WARNING : GRUB goes into sda's MBR
  • cd /boot/boot/grub
  • touch menu.lst
Create boot entries in menu.lst for GRUB to boot (# nano /boot/boot/grub/menu.lst)
My /boot/boot/grub/menu.lst looks like this :
timeout 10
title Slackware Linux 12.0
root (hd0,0)
kernel /vmlinuz root=/dev/md0 ro
boot
Save & Close.
Just to make sure that fstab mounts the right arrays in the right places, its better to take a look at it is in /etc before we boot into the system (# nano /etc/fstab)
My /etc/fstab looks something like this (Your's probably should look something similar to this ) :
/dev/md0 / ext3 defaults 1 1
/dev/sda1 /boot ext3 defaults 1 2
/dev/md1 /home ext3 defaults 1 1
just type 'exit' to get out of the system and into the DVD, unmount all the drives and reboot.
  • exit
  • umount /dev/sda1
  • umount /dev/md0
  • umount /dev/md1
  • umount /dev/md2
  • reboot
Now if all went well, your Slackware should boot normally that too from a RAID array! ;)
Enjoy !

Apache 2 + PHP 5 on Slackware 12

Installing Apache HTTP Server
  • tar zxvf httpd.tar.gz
  • cd httpd
  • ./configure --prefix=/usr/local/apache --enable-mods-shared=most --enable-deflate
  • make
  • make install
  • echo "/usr/local/apache/lib" >> /etc/ld.so.conf
  • ldconfig
For Apache to run at boot :
  • echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.d/rc.local
Installing PHP 5
  • tar zxvf php.tar.gz
  • cd php
  • ./configure --prefix=/usr/local --with-config-file-path=/etc --with-apxs2=/usr/local/apache/bin/apxs --disable-debug --enable-memory-limit --enable-inline-optimization --enable-magic-quotes --enable-mbstring --enable-track-vars --enable-xml --with-dom --with-xml --enable-sockets --with-zlib --with-gettext --with-pear
  • make
  • make install
  • cp php.ini-recommended /etc/php.ini
Edit /etc/php.ini and do the following:
  • change "short_open_tag" to On
  • change include_path to ".:/usr/local/lib/php"
Edit /usr/local/apache/conf/httpd.conf and do the following:
  • add "LoadModule php5_module modules/libphp5.so"
  • add "index.php" to DirectoryIndex
Now, get back to your terminal and just run the following.
  • echo "application/x-httpd-php php" >> /usr/local/apache/conf/mime.types
  • sudo /usr/local/apache/bin/apachectl start

    Done.

Sunday, June 1, 2008

Installing a Pixart Imaging, CIF Single Chip Webcam

Summer, 2008
Blissfully unaware about Hardware Compatibility Lists in driver pages, i finally got myself a USB web cam. It was this little thing i thought would work without hassle. >>

Looks like i was wrong. A `lsusb` output on my Debian GNU/Linux box and this was what i got :


$lsusb
093a:2460 Pixart Imaging, CIF Single Chip

Looking all good, i headed down to Google to search for the vendor ID. I ended up with this (http://mxhaard.free.fr/download.html) page and found out that my cam was supported by the spca5xx drivers. Downloaded the tarball from the same site, wasted a couple of hours downloading hell lot of dependencies for the compilation and finally it compiled. ;)

It just didn't work no matter what. The cam was sitting there literally for months together until i found another blog deeply hidden in Google in which the guy had the same problem as mine and thank heavens he had a workaround too.

So this is what i had to do :


$ cd /path/to/the/tarball/
$ tar xvf gspcav1-20071224.tar.gz
$ cd gspca/modules/gspca/Pixart/


Once there, you need to edit a file called pac207.h
In Line 137, replace
if(id[0]!=0x27) with if(id[0]!=0x27 || id[1]!=0x08)
So you'll end up with this :
....
PDEBUG(2, " Pixart Sensor ID 0x%02X Chips ID 0x%02X !!\n", id[0],
id[1]);
if(id[0]!=0x27 || id[1]!=0x08)
return -ENODEV;

return 0;
....

Well, that's pretty much it. Just save the file, close and rebuild it with "make" and "make install" as root.
Plug in the cam and you'll see some messages appear in
`dmesg | tail` if your webcam was successfully detected and gspca driver was loaded right and yes the cam was working!

P.S : If your kernel doesn't auto-load modules, just do a modprobe gspca