Create bootable USB drive with Fedora 11

June 18th, 2009

Here are quick steps on CentOS 5.3 box (should be identical on any RH based distro) to create a bootable USB stick of latest Fedora 11 distrubution:

1. Check whether required tools are already installed or not:

# rpm -q livecd
<no output>

2. Install tools:

# yum install livecd-tools

3. Insert your USB stick in one of USB port, it should get automatically detected and mounted. Make sure your stick has atleast 1 GB free space. Jump to step #7 as it’s absolutely not necessary to format it, but if there’s no worthy data in and you are willing to clean it completely before moving forward, here is the way to proceed after unmounting it:

# fdisk -l /dev/sda
Disk /dev/sda: 4043 MB, 4043309056 bytes
125 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7750 * 512 = 3968000 bytes

Device Boot      Start         End      Blocks   Id  System

4. Proceed to format:

# fdisk /dev/sda
Command (m for help): d
No partition is defined yet!
Command (m for help): n
Command action
 e   extended
 p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1018, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1018, default 1018):
Using default value 1018
Command (m for help): a
Partition number (1-4): 1
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 6
Changed system type of partition 1 to 6 (FAT16)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

## here, after initiating fdisk with USB device controller ie /dev/sda (it may be different in your machine, Please make sure you choose correct). We tried deleting (d) any existing partitions, then create new one (n) of type primary (p) with all avaialbe size. Then make this partition active (a) and assign (t) filesystem FAT 16 (6) to it. Save these changes or write these changes to device by pressing w.

5. Issue parprobe to detect new changes and check:

# partprobe
# fdisk -l /dev/sda
Disk /dev/sda: 4043 MB, 4043309056 bytes
125 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7750 * 512 = 3968000 bytes
 Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1018     3944719    6  FAT16

6. Format USB stick partition (sda1) with FAT file system and mount it:

# mkdosfs -n usbdisk /dev/sda1
mkdosfs 2.11 (12 Mar 2005)
# mount /dev/sda1 /mnt/cam
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda2              43G   17G   24G  42% /
/dev/hda5              51G   20G   29G  41% /var
tmpfs                 248M     0  248M   0% /dev/shm
/dev/sda1             3.8G  4.0K  3.8G   1% /mnt/cam

7. USB stick is ready for use, you should have ISO image of Fedora 11 in your machine to proceed. If you didnt downloaded yet, get it from here. I’m a kde fan, if you too, grab it from here.

8. Start the actual process of creating bootable and transferring files now. The command syntax is: livecd-iso-to-disk <ISO File path> <USB Device>:

# livecd-iso-to-disk F11-i686-Live.iso /dev/sda1
Verifying image...
F11-i686-Live.iso:   f21debace1339dbdefff323064d40164
Fragment sums: c22bcc22b29728f2a7136396121621caf6c18169f3326e5c7e66153cd57e
Fragment count: 20
Percent complete: 100.0%   Fragment[20/20] -> OK
100.0
The supported flag value is 0
The media check is complete, the result is: PASS.
It is OK to install from this media.
Copying live image to USB stick
Updating boot config file
Installing boot loader
USB stick set up as live image!

9. All Done! grab any PC available sideby and restart it (after saving fellows work :) . Go to BIOS menu, change boot option from HDD/CD to USB Drive, insert USB stick in one of avaiable USB ports. Start the PC and enjoy!!

General , , ,

Quickly install ffmpeg-php library in CentOS

June 15th, 2009

ffmpeg-php is a PHP extension that adds functions for accessing and retrieving information from movies and audio files.

Here’s quick steps which worked for me and you can try to install this library in a RedHat based distro (I’ve checked in a fresh CentOS 5).

Step 1. Install standard ffmpeg and its dependencies using yum:

# yum install ffmpeg ffmpeg-devel php-devel

Step 2. Download and install ffmpeg-php:

# cd /usr/src
# wget http://biznetnetworks.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
# tar xjf ffmpeg-php-0.6.0.tbz2
# cd ffmpeg-php-0.6.0
# phpize
# ./configure –enable-shared –prefix=/usr
# make
# make install

Here, we used phpize to create config files. You should check installation docs to enable more libraries through configure command.

php

Apache url rewriting with masking

June 2nd, 2009

I got an assignment where I’ve to move some apps from a server (due to immense load) to different server without changing URLs. Main software app should remains in first server and all other smaller apps should be moved to another server but because all apps are integrated (for seamless login etc) with each other, URL on the browser should not change when browing the main app or any of its subordinate apps residing on different server.

The quick solution is to update httpd.conf in your main server to redirect traffic for certain apps to different server (or domain). Apache will work like a proxy when accessing other apps. for example, here are sample URLs:

Main Application: http://www.maindomain.com/
Pages of main application: http://www.maindomain.com/something.html
Other application 1: http://www.maindomain.com/wiki/
Other application 2: http://www.maindomain.com/forums/

Here’s what I’ve used, open httpd.conf and add following lines in it:

RewriteEngine on
RewriteRule ^/wiki/(.*) http://otherdomain.com/wiki/$1 [P,L]
RewriteRule ^/forums/(.*) http://otherdomain.com/forums/$1 [P,L]

ProxyPassReverse / http://otherdomain.com/

Details:
Pls make sure that mod_proxy and mod_rewrite are loaded in apache. In above lines:

line 1: Turns on rewrite engine provided by mod_rewrite
line 2 and 3: A rewrite rule to parse the url and detect the word (wiki) in begining of it. if word is there, then rewrite url using different domains (or IP address). The last parameter [P] indicates that its a proxy request.

line 4: URL that needs to be masked while browsing.

Save file, restart/reload httpd service and check. It worked in my case but your requirement may be different, I recommend having of a look of official documentation for url rewriting.

Web Server , , ,