Selasa, 31 Januari 2006

Create a custom Linux distribution online

In the process of installing different Linux distributions, I have realized that none of the Linux distributions install every software that I want and in all cases, they install many unneeded software too thus taking up excess disk space. Of course I leave out 'Linux from Scratch' project and 'Gentoo' from what I have said above but installing these two are beyond the scope of neophytes in Linux.

Wouldn't it be nice if we could pick and choose which software to be included in a Linux distribution and once we commit our choice, an ISO image of the Linux distribution was created on the fly and made available for download ?

Well then, you have just got your wish. A website called instalinux aims to provide just that. On their site, you first decide your choice of Linux distribution and then pick and choose the software that need to be bundled with it, all from the confines of a web interface. Once you have finished, you are presented with an ISO image of the distribution of your choice for download, containing just the software you have selected. You can choose from Fedora, Debian, Suse and Ubuntu Linux.

This site is worth a try for people who have low bandwidth Internet connection or those who are looking to re-master their favorite Linux distribution.

Senin, 30 Januari 2006

Which software would you like to see ported to Linux?

I have always wondered about this all the while not because I am unhappy with the applications currently bundled with Linux. But purely in a business point of view, this is a pertinent question. A major reason that businesses shy away from embracing Linux is because many of the software that they use do not have a Linux equivalent. And some of these software do play a dominant role in the market in their respective spheres.

I can think of a few software like Adobe Photoshop, FlashMX, Director, Quicken Financial software, Shockwave and Adobe Illustrator to name a few.

Now Novell - a big shot in the Linux distribution market - is running a survey to determine which applications the users feel is critical for their enterprises and would like them to be ported to Linux. So if you have any software in your wish list which run only on Windows at present, then this is the right time to visit their site and let yourselves be heard.

Jumat, 27 Januari 2006

Effective Partitioning - The How and Why of it

A few days back, when my non-techie friend came to visit me at home, he was amazed to see me booting into multiple OSes (4 to be exact) on my machine. He then wanted to know how I accomplished this feat. I told him about creating partitions and how these partitions play a vital role in installing multiple operating systems on ones machine. But this conversation with my friend set me thinking; why is there so much fuss on creating partitions? I think the primary reason that people face this issue of re-partitioning is because they do not think ahead about their future needs.

Even I have faced this problem of re-partitioning my hard disk many a times. And each time, it was a fine balancing but time consuming act of shifting important data from one partition to another, sometimes taking backup and also at times wiping the disk clean and starting afresh.

At present, I run 4 OSes on my machine. Them being Windows XP, FreeBSD, Ubuntu Breezy and Gentoo Linux. For the curious ones, my hard disk is partitioned as follows :

# fdisk -l
Disk /dev/hda: 40.0 GB, 40020664320 bytes
16 heads, 63 sectors/track, 77545 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 38745 19526976 7 HPFS/NTFS
/dev/hda2 38745 47461 4393336+ a5 FreeBSD
/dev/hda3 47462 48466 506047+ 82 Linux swap
/dev/hda4 48466 77536 14651280 5 Extended
/dev/hda5 48467 65902 8787523+ 83 Linux
/dev/hda6 65902 77536 5863693+ 83 Linux
As you can see above, I have divided my entire 40 GB hard disk into three primary partitions and one extended partition and the extended partition is further divided into two logical partitions (See figure below).

Fig: A view of my partitioned hard disk

You must be aware that one can create only 4 primary partitions per hard disk. The big question is why just 4 ? Why can't we create more than that number? The reason lies in the boot sector. In your primary hard disk, the first 512 bytes is reserved for storing the partition table also called the Master Boot Record (MBR). The problem is that this space fills up after storing just 4 records. So to create multiple partitions, a work around was found out. That is creating an extended partition whose address was stored in the partition table and then creating any number of sub partitions (called logical partitions) inside the extended partition.

Creating partitions is also dependent on the type of file system and OS used
For example, way back when I used to install Windows 95/NT, I remember having to split the hard disk into partitions of 2 GB size. This was because the file system used at that time FAT16 could not reside in partitions with sizes over 2.1 GB. Though the newer version FAT32 or NTFS does not have this limitation.

Similarly, OSes like Sun Solaris and FreeBSD can be installed only in primary partitions.

Deep thought should be given prior to creating partitions
The major work in creating partitions is to decide how many partitions to create and how much space to allocate to each of them. If too little is allocated, within no time, all the space will be filled up. And if too much space is allocated, then there will be a lot of unused space being wasted left around.

Generally speaking for Linux/Unix mail servers, you put the /var directory in a separate partition. This is because the users mail box resides in this directory. And if you are allowing the public to create email accounts on your machine, then in no time, the /var directory will get filled up and will eat up the remaining space on the hard disk and in the process bring the server down. This will not happen if /var resides in its own partition.

Should /tmp reside in a separate partition ?
A few people believe that the /tmp directory in Linux/Unix should reside in its own separate partition. There is a good reason for it. That is, the /tmp directory is world writable. If you do a long listing of the /tmp directory ...

$ ls -ld /tmp
drwxrwxrwt 14 root root 4096 2006-01-28 16:32 /tmp
... you will find that the directory is having read, write and execute permissions for all. Now why is that a bad thing? It is not exactly bad and has its uses. But a hacker (if he knows your IP address and is able to access your machine behind the firewall), will be able to upload and execute programs in the /tmp directory thus making your system vulnerable. For one, he can upload a tiny program to your /tmp directory, which when run will create a core dump.

Core dumps are files of huge sizes (some can be 1 GB size) which are generated when a faulty program is run on a Linux/Unix machine. A core dump can be used by a developer for finding out what is wrong with his program, but that is besides the point. One can imagine what will happen if the hacker repeatedly executes his tiny program and creates a series of core dumps on your machine. In no time, all the space on the hard disk will be filled and your system will crash.

Note: I have found out that in Ubuntu the functionality of creating core dumps is disabled by default. So people using Ubuntu can have the /tmp directory in the same partition as the '/' .

Another thing I feel positive about is creating a separate partition for the /home directory. This way, one can easily reinstall the operating system or switch distributions without worrying about creating backups. More over if you are using multiple Linux distributions like I do (see figure above), then you can have the same /home directory for both distributions.

How do you create a partition ?
There are a variety of tools available right from the ubiquitous fdisk to ranish partition manager, qparted, cfdisk to commercial products like Partition Magic. But as a long time Linux user, I would recommend learning to use fdisk. This is because even though it uses cryptic commands, once you master it, partitioning becomes a piece of cake. Also in emergencies, you will not be left high and dry for want of your favourite partitioning tool because fdisk is bundled with all Linux distributions and Unixes alike.

Will partitions ever go out of vogue ?
I think we will have to put up with partitioning for a couple more years. But with the recent interest in virtualisation technologies (like Vmware, Xen, Usermode Linux and QEMU), which allow one to run any operating system over another at the same time, and also taking into consideration the increase in processing power and availability of cheap memory, I feel, may be in 10 years or so, people will opt out of partitioning their hard disks all together.

Update:
I forgot to mention that the partition housing FreeBSD (see figure above) was originally a FAT32 partition which I was using to share data between Linux and Windows. Because I felt a bit lazy or just didn't feel like it, I opted for converting the FAT32 primary partition to UFS2 to install FreeBSD. If you are considering dual booting between Windows and Linux, it is beneficial to have atleast a small FAT32 partition to facilitate sharing of data between the two OSes.
Also Read:
Creating and resizing a Logical Volume Manager in Linux

Kamis, 26 Januari 2006

Learn how to use regular expressions the easy way

I am sure many of you will agree with me if I tell you that regular expressions are an integral part of all Posix operating systems. So what exactly are regular expressions ?

Regular expressions are characters that also include symbols which when used in a group, convey a special meaning to the shell. Broadly speaking, there are a few frequently used characters which are interpreted by the shell in a special way. They are as follows:

? - Question mark is used to mean a character repeated at most one time. That is 0 or 1 times.
* - Asterisk means the preceding character is repeated any number of times.
. - A dot signifies any character.
^ - The beginning of the line
$ - End of the line
\ - Used when you want to represent the special characters literally. For example, to show '*', I can use '\*' which tells the shell not to interpret the literal.

For example, a regular expression 'ap?le*' will select the following strings:
aplee
aple
aleee

but not 'apple' or 'appplee' because 'p' can occur only 0 or 1 times.

Usually, people are a bit confused the first time they have to use regular expressions. I was, the first time I used them.

For those who find learning regular expressions a real chore, there is a very useful utility called kregexpeditor which is bundled with Linux running KDE. This utility can be used effectively to come up to date with regular expressions. See figure below.

Fig: KRegExpEditor interface (Click on picture)

kregexpeditor has a very intuitive interface and contains both an inbuilt graphical editor, a verification window as well as a command line edit where one can try out different combinations of regular expressions. For example, try figuring out for yourselves what the following regular expression selects ...
\b[A-Z0-9._%-]+@[A-Z0-9-]+\.[A-Z]{2,4}\b 
Hint: Open up kregexpeditor and enter the above regular expression into the line edit box labeled Ascii Syntax. And you will get a graphical representation of what this string expands to in the upper portion of the editor.

Rabu, 25 Januari 2006

Illustrating desktop Linux distributions through screencasting

If you are the curious type and would like to compare how other Linux distributions package their desktops, then you are in luck. Now you can get a feel (a tiny one though) of different Linux distributions without installing and trying them out.

LinClips has put together a collection of flash videos which gives a peep into the desktops of different Linux distributions including the menu layout and the softwares bundled with them. What is even better is that each clip runs for exactly 2 minutes which brings it to the reach of people with low bandwidth internet connection.

Senin, 23 Januari 2006

Festival - A Text to Speech synthesis software in Linux

What is Festival ?


Festival is a free text to speech synthesizer developed by the Center for Speech Technology Research at the University of Edinburgh.

It is shipped with most Linux distributions and has been released under an X11-type license allowing unrestricted commercial and non-commercial use alike.Read more »

Sabtu, 21 Januari 2006

Diverse experiences of a professional Unix/Linux Administrator

Unix/Linux administrators have great stories of their experiences at work, their day-to-day interactions with the Windows admins and the often hilarious situations they face. Here is an excellent post of a professional Unix/Linux administrator who has had many such light hearted experiences during his interaction with his Windows counterparts.

What makes this article unique is that the author has desisted from showing the Windows administrators in bad light while at the same time giving it a humorous tinge. A very good read for a light hearted moment.