Tuesday, April 9

Linux TOP Command

Top command options:
Line 1: Gives System present time, up time of the machine, number of users logged in, Load average on system at 1, 5, 15 min interval. Please ignore the values which mention load average as 5,10 and 15 mins.
Line 2: Gives total number of process on the machine, number of running process, number of sleeping process, number of stopped process, number of Zombie process.
Line 3: Gives you CPU details
Line 4 &  5: Gives RAM and SWAP details.
Line 6: To execute top command shortcuts(See below for the list of top command shortcuts ).
From Line 7: dynamically displayed top process results.
 top commands shortcuts:

The Runlevels in Linux

Many Windows users are familiar with different modes of execution of their operating system:
a. Safe mode
b. Command prompt only
c. Safe mode with network support
d. Safe mode with vga


And other such options that are presented during the boot-up process. Similarly, Linux has different modes of executing as well, which are known as runlevels. But unlike Windows, we can change runlevels on a fly.
Definition for runlevel : The term runlevel refers to a mode of operation in one of the computer operating system that implement Unix System V-style initialization. This system replaces the traditional /etc/rc and /etc/rc.local scripts used in BSD UNIX. Conventionally, seven runlevels exist, numbered from zero to six, plus an alias runlevel named ‘S’ and/or ‘s’.
Runlevels control services started by the initialization process. The number of runlevels and services started on those runlevels varies with Linux distributions. Information about the runlevels of a particular distribution is listed in file /etc/inittab.
The contents of the file include the following:
DNameDescription
0HaltShuts down the system.
1Single-user ModeMode for administrative tasks.
2Multi-user ModeDoes not configure network interfaces and does not export networks services.
3Multi-user Mode with NetworkingStarts the system normally.
4Not used/User-definableFor special purposes.
5Start the system normally with appropriate display manager. ( with GUI )As runlevel 3 + display manager.
6RebootReboots the system.

Linux Booting Process

Knowing Linux booting process is an essential part of every Linux user/administration which will give you a clear picture of how Linux Operating system works. In this post we will see what happens when a Linux OS boots i.e. after powering on the machine to the user log-in prompt. Below image will give you clear idea what will happen in Linux booting process.

Linux Booting process

A quick view of booting sequence:
Power on
CPU jumps to BIOS
BIOS runs POST
Finds first bootable device
Load and execute MBR
Load OS
User prompt
This a rough idea what happens in Linux booting. Below are the detailed stages in Linux Booting process.
Stages of Booting:
1)System startup(Hardware )
2)Boot loader Stage 1 (MBR loading)
3)Boot loader Stage 2 (GRUB loader)
4)Kernel
5)INIT
6)User prompt

Monday, April 1

Building a Apache Web Server

If you have not yet installed your Linux OS, or just for future reference, do not choose to install Apache  during the system installation. Then you can immediately proceed with the source-based install listed here.

Note: to install applications from source code, you will need a C++ compiler (gcc++) installed. This is generally taken care of, but I've had enough queries about it that I've added this note to avoid getting more! You can use your distribution's install CDs to get the proper version of the compiler.

yum install gcc gcc-c++

If you do not have direct access (via keyboard) to the server, PLEASE use Secure Shell (SSH) to access the server and not telnet!! Whenever you use telnet (or plain FTP for that matter), you are transmitting your username, password, and all session information in "plain text". This means that anyone who can access a machine someplace between your PC and your server can snoop your session and get your info. Use encryption wherever possible!

Get the Source Code for all Applications
We want to put all our source code someplace central, so it's not getting mixed up in someone's home directory, etc.

cd /usr/local/src