Wednesday, 27 April 2005
Compiling a linux kernel from source
Monday, 25 April 2005
The /proc filesystem
- /proc/interrupts - View IRQ settings
- /proc/cpuinfo - Information about the system's CPU(s)
- /proc/dma - Direct Memory Access (DMA) settings
- /proc/ioports - I/O settings.
- /proc/meminfo - Information on available memory, free memory, swap, cache memory and buffers. You can also get the same information using the utilities free and vmstat.
- /proc/loadavg - System load average
- /proc/uptime - system uptime and idle time. Can also be obtained using utility uptime.
- /proc/version - Linux kernel version, build host, build date etc. Can also be obtained by executing `uname -a`.
- /proc/scsi - Gives information about SCSI devices
- /proc/ide - information about IDE devices
- /proc/net - information about network activity and configuration
- /proc/sys - Kernel configuration parameters. The values in files in this directory are editable by root, which I will further explain below.
- /proc/
- information about process PID.
- /proc/sys/fs/file-max
This specifies the maximum number of file handles that can be allocated. If some of your users get an error when trying to open more files stating that the maximum limit of number of open files have been reached, then you need increase the value in this file (default is 4096) to set the problem straight as follows :# echo "10000" > /proc/sys/fs/file-max
- /proc/sys/fs/super-max
This specifies the maximum number of super block handlers. Any filesystem you mount needs to use a super block, so you could possibly run out if you mount a lot of filesystems.
Default setting: 256 - /proc/sys/kernel/acct
This holds three configurable values that control when process accounting takes place based on the amount of free space (as a percentage) on the filesystem that contains the log:
- If free space goes below this percentage value then process accounting stops.
- If free space goes above this percentage value then process accounting starts.
- The frequency (in seconds) at which the other two values will be checked.
Default setting: 2 4 30
These values will stop accounting if there is less than 2 percent free space on the filesystem that contains the log and starts it again if there is 4 or more percent free space. Checks are made every 30 seconds. - /proc/sys/kernel/ctrl-alt-del
This file holds a binary value that controls how the system reacts when it receives the ctrl+alt+delete key combination. The two values represent:
- A zero (0) value means the ctrl+alt+delete is trapped and sent to the init program. This will allow the system to have a graceful shutdown and restart, as if you typed the shutdown command.
- A one (1) value means the ctrl+alt+delete is not trapped and no clean shutdown will be performed, as if you just turned the power off.
- /proc/sys/kernel/domainname
This allows you to configure your network domain name. This has no default value and may or may not already be set. - /proc/sys/kernel/hostname
This allows you to configure your network host name. This has no default value and may or may not already be set. - /proc/sys/net/ipv4/ip_forward
This allows you to turn on/off IP forwarding. If the value in this file is "1" then ip forwarding is turned "on "and if value is "0" then ip forwarding is turned off.
# sysctl -p... to make the kernel reread the changes from the /etc/sysctl.conf file.
There are two simple rules for converting between files in /proc/sys and variables in sysctl:
- Drop the /proc/sys from the beginning.
- Swap slashes for dots in the filenames.
So /proc/sys/net/ipv4/ip_forward will become net.ipv4.ip_forward
There is an interesting article about the /proc filesystem at Linux Gazette.
Friday, 22 April 2005
Resizing Logical Volumes
- Reduce the filesystem residing on the logical volume.
- Reduce the logical volume.
For ext2 file system
# umount /data
# e2fsadm -L -1G /dev/my_vol_grp/my_logical_vol
# mount /data
# umount /data
# resize2fs /dev/my_vol_grp/my_logical_vol 1G
# lvreduce -L 1G /dev/my_vol_grp/my_logical_vol
# mount /data
Reiserfs file system
# umount /data
# resize_reiserfs -s -1G /dev/my_vol_grp/my_logical_vol
# lvreduce -L -1G /dev/my_vol_grp/my_logical_vol
# mount -t reiserfs /data
XFS and JFS filesystemsGrow a Logical Volume
- Enlarge the logical volume first.
- Then resize the filesystem to the new size of your logical volume.
Thursday, 21 April 2005
Creating a LVM in Linux
- LVM created in conjunction with RAID can provide fault tolerance coupled with scalability and easy disk management.
- Create a logical volume and filesystem which spans multiple disks.
By creating virtual pools of space, an administrator can create dozens of small filesystems for different projects and add space to them as needed without (much) disruption. When a project ends, he can remove the space and put it back into the pool of free space.
To create a LVM, we follow a three step process.
# pvcreate /dev/hda1 /dev/hda2 /dev/hda3
# pvscan
# vgscan
# vgcreate my_vol_grp /dev/hda1 /dev/hda2
# vgcreate -s 16M my_vol_grp /dev/hda1 /dev/hda2You can check the result of your work at this stage by entering the command:
# vgdisplay
# lvcreate -l 50 -n my_logical_vol my_vol_grp
# lvdisplaywhich shows the information of your newly created logical volume.
# mke2fs -j /dev/my_vol_grp/my_logical_volThe -j signifies journaling support for the ext3 filesystem we are creating.
Mount the newly created file system :
# mount /dev/my_vol_grp/my_logical_vol /dataAlso do not forget to append the corresponding line in the /etc/fstab file:
#File: /etc/fstabNow you can start using the newly created logical volume accessable at /data mount point.
/dev/my_vol_grp/my_logical_vol /data ext3 defaults 0 0
Next : Resizing Logical Volumes
Wednesday, 20 April 2005
The Process of Chip making explained
Really Interesting !!
Tuesday, 19 April 2005
Prevent a non-root user from shutting down or rebooting the system
- In the file /etc/X11/gdm/gdm.conf , change the line that reads :
SystemMenu=true
to
SystemMenu=false
- In the file /etc/inittab, change the line that reads :
ca:ctrlaltdel:/sbin/shutdown -t3 -r now
to
ca:ctrlaltdel:echo "You are not authorized to turn off the machine"
- In the directory /etc/security/console.apps/, delete the file reboot, poweroff and halt.
- Remove the file /usr/bin/poweroff
Now only the root user will be able to turn off or reboot the machine.
Monday, 18 April 2005
The GPL FAQ
GPL stands for GNU Public Licence. It gives the end user the right to use, view, modify and share the source code of any software which has been released under this licence. And yes Linux is free because it is released under GPL. You can find answers to all these and more at the Official FSF FAQ on GNU GPL.
Sunday, 17 April 2005
Window Managers in Linux
Window managers are X client programs which are either part of a desktop environment or, in some cases, standalone. Their primary purpose is to control the way graphical windows are positioned, resized, or moved. Window managers also control title bars, window focus behavior, and user-specified key and mouse button bindings.
Having said that, there are a lot of window managers for linux. So the user has the flexiblity to modify the look and feel of his GUI environment according to his tastes.
- kwin — The KWin window manager is the default window manager for the KDE desktop environment. It is an efficient window manager which supports custom themes.
- metacity — The Metacity window manager is the default window manager for the GNOME desktop environment. It is a simple and efficient window manager which supports custom themes.
- mwm — The Motif window manager, is a basic, standalone window manager. Since it is designed to be a standalone window manager, it should not be used in conjunction with the GNOME or KDE desktop environments.
- sawfish — The Sawfish window manager is a full featured window manager. It can be used either standalone or with a desktop environment.
- twm — The minimalist Tab Window Manager, which provides the most basic tool set of any of the window managers and can be used either standalone or with a desktop environment. It is installed as part of X.org.
- fluxbox - A very popular light weight window manager.
- fvwm - Fvwm was designed to minimize memory consumption, provide a 3-D look (similar to from Motif's mwm) and provide a simple virtual desktop. Functionality can be enhanced by the use of various modules.
- Afterstep - This is a window manager based on fvwm but designed to emulate some of the look and feel of Apple's NeXtStep interface.
- IceWM - Another light weight window manager with a windows 98 like interface....these are just a few that come to my mind.
There are a lot more.
So what is the difference between a window manager and a desktop ?
The difference is that Desktop environments have advanced features which allow X clients and other running processes to communicate with one another and allow all applications written to work in that environment to perform advanced tasks, such as drag and drop operations; Cut, copy and paste data between different applications to name a few and, they supply their own range of integrated utilities and applications. This convenience and ease of use makes them particularly attractive to new users, which has made them very popular. A Desktop environment displays a more polished front to the user. Some of the more popular desktop enviroments are Gnome, Kde, XFce and cde.
You can also run the window managers as standalone. For example, try running twm window manager as follows from the command line:
# startx -e
To start twm, try:
# startx -e twm
This will give you a fair idea about the differences between window managers and desktop environments.
$100 Laptops running Linux
Check out these photos:
Updates :
- You can read in detail a review of the first prototype at worldchanging.com .
- Red Hat officially commits to MIT's $100 laptop. (Jan 31st 2006)
Thursday, 14 April 2005
A collection of PDF viewers for GNU/Linux
Saturday, 9 April 2005
Installing linux on a Mac Mini
Tuesday, 5 April 2005
Configuring Apache webserver to restrict access to your website
- Either by the hostname of the browser being used
- By asking a username and password
- Create a file containing username and passwords - Apache webserver has a utility called htpasswd to create the file containing username and passwords. Here I am creating a file called 'users' in the /usr/local/etc/ directory.
The first time you run the htpasswd utility, you run it using the -c flag as follows:
# htpasswd -c /usr/local/etc/users gopinath
gopinath:WrU90BHQai36The first field is the username and the second field is the encrypted password.
kumar:iABSd12QWs67
ankit:Wer56HsD12s6
AllowOverride NoneAnd change it to
AllowOverride AuthConfig
#File: .htaccess
AuthName "Only Valid Access"
AuthType Basic
AuthUserFile /usr/local/etc/users
require valid-user
Lastly don't forget to restart the web server which rereads the changed configuration files :
# service httpd restart