Wednesday, June 30, 2010

How to edit a read-only /etc/fstab during single-mode on CentOS

If somehow like me, you edited the /etc/fstab wrongly and have to enter the maintenance mode to rescue it but was not able to edit it.



For this blog entry, I'm writing on using a Linux CD to do a rescue.

Step 1: Put in the CentOS 5.4 CD and boot to CD

Step 2: Press F5 and type linux rescue at the boot prompt
linux rescue

Step 3: When given the command prompt again after a series of screen
# vi /mnt/sysimage/etc/fstab
Do the necessary changes to /etc/fstab
Step 4: Do the reboot
# reboot

Wednesday, June 23, 2010

MEEP a free finite-difference time-domain (FDTD) simulation software package

From the MEEP Website
"Meep (or MEEP) is a free finite-difference time-domain (FDTD) simulation software package developed at MIT to model electromagnetic systems, along with our MPB eigenmode package......"
For more information on MEEP,
  1. MEEP Manual
  2. MEEP Download
  3. MEEP FAQ

Monday, June 21, 2010

Rpmbuild Tutorial

RPMBuild is used to build both binary and source packages that can be used with the rpm commands.

There are a few good resources
  1. Rpmbuild Tutorial is a detailed well-written tutorial on rpmbuild utilities.
  2. RPM.org User Documentation is also another good material to read on.
  3. RPM Guild an excellent document that covers all aspects of the Red Hat Package Management system

Sunday, June 20, 2010

Protecting GRUB Boot loader for CentOS

Much of the material is taken from "How Do I Secure Grub Boot Loader?" taken from http://www.cyberciti.biz/ and the book "Foundation of CentOS Linux" from aspress

Without the GRUB Password, anyone can edit the kernel parameters and boot into single-user mode and  enable them to log as root.

Step 1:
Use grub-md5-crypt command encrypt password in MD5 format:
# grub-md5-crypt

Password:
Retype password:
$1$gBrNd/$QccThGN4QFPdOiOtaTl.c0



Step 2: Edit GRUB configuration file
# vi /boot/grub/menu.lst

Insert this line into /boot/grub/menu.lst
password --md5 $1$gBrNd/$QccThGN4QFPdOiOtaTl.c0

Something like this....
# grub.conf generated by anaconda
#........
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
password --md5 $1$H7tNd/$GEYVMUDHmIkhb4xwNwywR.
title CentOS (2.6.18-164.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-164.el5.img

It's done. Horray

Saturday, June 19, 2010

Boot Time Parameters for Linux Kernel on CentOS 5

In CentOS, the default boot lader is GRUB (Grand Unified Boot loader). GRUB allows users to choose which operating system you would like to boost. In addition, GRUB can be used to inform or pass parameters to the kernel

How to modify GRUB

Step 1:
When GRUB start, press any keys and it will show you a boot menu.

Step 2:
In the menu, you can select the kernel to boot and press "e"

Step 3: You will see something like this on the screen
grub append > ro root=LABEL=/ rhgb quiet

Step 4a: Put in the necessary parameters. For example, if I wish to boot to "single"
grub append > ro root=LABEL=/ single

Step 4b: If I wish to boot into console with network support, use the parameter: init=/sbin/init 3
grub append > ro root=LABEL=/ init=/sbin/init 3

Step 4c: If I wish to specify the memory, use the parameters: mem=MEMORY_SIZE
grub append > ro root=LABEL=/ mem=1024M

Step 4d: If you wish to reboot the kernel after the kernel panic, you can set the parameter panic=SECOND
grub append > ro root=LABEL=/ panic=30

For more parameters, do read the excellent article on
  1. 10 boot time parameters you should know about the Linux kernel
  2. Booting to Single Mode for Centos LINUX

Friday, June 18, 2010

Cloud Computing - Office Suites & Tools

There is an interesting information on Cloud Office suites & tools. Taken from "The rough guide to cloud computing" by Peter Buckley and continuation of "Rough Guide to Clouds Computing - Office Suties & Tools" Blog Entry. Please buy the book for the comprehensive lists. I'm listing only a few interesting sites that the book mentioned


Office Suites
  1. Google Docs
  2. Office Live Workspace
    A useful web-based environment from MS where one can work, share and store office documents.
  3. Slide Rocket
    A presentation cloud that have impressive kit and interface
  4. TwiddlaA browser based whiteboard meeting tool
  5. DimdimA web-based conferencing and collaboration tool

Thursday, June 17, 2010

Rough Guide to Clouds Computing - File Sharing

Interesting book on Clouds Computing on Internet. I read this sniffy little book "The rough guide to cloud computing" by Peter Buckley. It seems sometimes for users cloud computing seem quite mysterious but most of us are already on cloud consciously or not.

I like the session on storage and office tool. Buy the book if you are curious. Some of the interesting site mentioned are
File Sharing
  1. MailBigFile.com
    Transfer large files if they are too big for email. Upload up to 2GB per file.
  2. RapidShare
    Upload up to 200MB file and even spilt archive
  3. You Send It
    Upload up to 2GB per file
Online Storage
  1. Microsoft SkyDrive
    Can provide up to 25GB on storage for anyone with a Windows Live
  2. Microsoft Live Mesh
    Allow syncing of files between the cloud and seperate pcs. Interesting! Up to 5GB
  3. Sugarsync
    Award-winning file backup & sync software. Up to 2GB.
For more read the book :)

Wednesday, June 16, 2010

Using grep command line to search

Read this an article from Linux Format on grep by Faye Williams (July Edition). I thought the article was a good introduction on the use of grep. I'll pen down some useful tips

Example 1: To find all instances of "error"
$ grep error /var/log/messages

Example 2: To find all instances of "error", regardless of capitalisation, or case-insensitive, use the flag "-i"
$ grep -i error /var/log/messages

Example 3: Resursive check, use the "-r" flag
$ grep -ri /var/log/messages

Example 4: Colour your output with --color=auto
$ grep -ri --color=auto error /var/log/messages

Example 5: Whole word matching with "-w" flag
$ grep -riw error /var/log/messages

Example 6: Count the number of matches
$ grep -riwc error /var/log/messages

Example 7: To search for more than 1 word, put a quote
$ grep -ri 'ACPI Error' /var/log/messages


Finally, need help?
$ grep --help
$ man grep

Monday, June 14, 2010

Fstab and Device UUID on Fedora

When I added a Hard Disk on my Fedora box, I noticed that the /etc/fstab are already using UUID to mount disk.

Knowing UUID is quite essential if you wish to mount the drives using /etc/fstab especially for more current version of Linux. The advantage of using UUID is really identify the disk correctly and mitigate mounting issues caused by reordering of HDD

First thing first, you may want to list all the detected devices by UUID
# ls -l /dev/disk/by-uuid/

To list the UUID of a particular disk For example /dev/sdb1, you can use blkid command
# blkid /dev/sdb1

Much thanks to fstab with uuid by Linux by Example

Sunday, June 13, 2010

Changing IP Address or Server Name for Gallery configuration file

I was searching how to change the IP Address / Server Name for the  Open Source Gallery software. Finally realise how to change with command line
# vim /var/www/html/gallery/config.php
sdsdsd

.......
$gallery->app->photoAlbumURL = "http://linuxtoolkit.blogspot.com/gallery";
$gallery->app->albumDirURL = "http://linuxtoolkit.blogspot.com/gallery";
.......

Monday, June 7, 2010

Installng E-Book Reader - FBReader for Fedora 12


FBReader is an e-book reader for various platforms. Currently FBReader works on both Linux and Windows.

FBReader supports a number of format including: epub, fb2, chm etc. For more information on the supported format, read Electronic Book Formats (supported and unsupported). However, pdf is not fully supported except for text which is quite a waste.

It s definitely a very light and low resource footprint application. You may want to consider Evince for a Desktop Document Reader Gnome evine - Document Viewer

To install for fedora 12, just do a
# yum install fbreader

Sunday, June 6, 2010

Setting ProFTPD on Fedora and CentOS

I have not setup FTP server for a long time. Most of the time when I want to transfer files, I usually use SCP of SFTP. But this blog entry is a simple instruction set how to setup and configure basic FTP service. I'm using the ProFTPD on Fedora 12. Most of the material has been taken and modified from Linux Format Magazine

First thing first. What is ProFTP?

 ProFTPD is a stable and full-featured FTP Server. It can be run as a standalone server or from xinetd. It supports anonymous, authenticated logins, authenticated with LDAP directories or even sql databases.

 Installation of ProFTP Server
yum install proftpd
chkconfig --levels 235 ptoftpd on

To enable anonymous logins, edit the /etc/sysconfig/proftpd file
# vim /etc/sysconfig/proftpd

Inside the /etc/sysconfig/proftpd file
PROFTPD_OPTIONS="-DANONYMOUS_FTP"

# service proftpd restart

The default home directory of the anonymous logins is /var/ftp/
The default directory to place content for anymous users to put is at /var/ftp/pub
The default directory for anonymous users to upload to /var/ftp/upload


2. Virtual Hosting
Unfortunately, FTP require different IP Address for each site even though it is supposed to be virtual hosting. Unlike HTTP protocol which includes a host header field.

 Assuming you have several IP Addresses which you can use uniquely for your Virtual Hosting, you still need to set up IP Alias on the network card and a "VirtualHost" section in the proftpd.conf

Create a Network Card Alias
Step 2a - Create a network card alias for the network card
# touch /etc/sysconfig/network-scripts/ifcfg-eth0:N 
(where N is the alias number)

Step 2b: Inside ifcfg-eth0:N
DEVICE=eth0:1
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.2
HARDWARE=xx:xx:xx:xx:xx:xx

Step 2c: Restart Network Service
# service network restart


Step 3: Configure the VirtualHost inside the /etc/proftpd.conf
The script is rather long, you can get a sample from http://www.proftpd.org/docs/configs/virtual_authuserfile.conf

Bascially, you can change the Default Chdir to a new path ie /var/ftp/site2/pub. You can also change the message /var/ftp/site2/welcome.msg


Further Notes:
  1. List of Directives for ProFTPD configuration files 
  2. Active FTP vs. Passive FTP, a Definitive Explanation
  3. Virtual Hosting With Proftpd And MySQL (Incl. Quota)
  4. PROFTPD virtual user – quick howto

Wednesday, June 2, 2010

Reading the Linux manual pages online

I know that there are many online manual for Linux. I particularly like "Linux man pages" from http://linux.die.net/man/ as it not only have hyperlinks and quite a large repositories of linux tools. Not too bad

Tuesday, June 1, 2010

Voltaire 40 Gb InfiniBand Switch Module for IBM BladeCenter (IBM Redbook)

This Voltaire 40 Gb InfiniBand Switch Module for IBM BladeCenter (IBM Redbook) is a good writeup on hardware requirements to setup Voltaire 40 Gb InfiniBand Switch Module on IBM Blade Center H