Friday, January 7, 2011

Configuration of Apache webserver

Configuration of Apache webserver on httpd.conf
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default.
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 80
# User/Group: The name (or #number) of the user/group to run httpd as.
# . On SCO (ODT 3) use "User nouser" and "Group nogroup".
# . On HPUX you may not be able to use shared memory as nobody, and the
# suggested workaround is to create a user www and use that user.
# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
# when the value of (unsigned)Group is above 60000;
# don't use Group #-1 on these systems!
#
User nobody
Group #-1
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
DirectoryIndex index.html
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
#
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#

Procedure to setup Apache Tomcat on Linux Server

Apache Tomcat Server setup
1.Files Required:
JDK (latest version) : http://java.sun.com [ TO INSTALL JAVA]
Apache Tomcat (latest version) : from http://tomcat.apache.org [ TO INSTALL TOMCAT ]
Apache HTTP server (latest version) : from http://httpd.apache.org [ TO INSTALL APACHE ]
Tomcat connector - mod_jk (latest version) : from http://tomcat.apache.org [ TO DOWNLOAD TOMCAT CONNECTOR ]
2.Preinstallation Requirements:
Before Installing the Apache HTTP server on Linux , the following package dependencies have to be installed in Linux box(while making RPM installation).
· Package: httpd-, gcc, sysstat
· Firewall configuration for port 80(default http),8080 and 22
· Hostname have to be registered in DNS
3. Information
The following order should be made for installation Apache/Tomcat on linux box
1.Java should be installed if we are configuring tomcat
2. Apache tomcat must be configured with the java and test the sample page
3.Apache HTTP server must be installed.
4.Tomcat connector must be installed
4. Installing JAVA:
Step 1: Download latest J2SE EE SDK from http://java.sun.com into the local linux box (The downloaded package will be like jdk--i586.rpm.bin)
Step 2:Execute installer (note : must be done as root)
# chmod +x jdk--i586.rpm.bin (setup execute permission to the downloaded bin file)
Step 3: Install java
# ./jdk--i586.rpm.bin
Do you agree with the above license terms? Yes
(then installation should proceed)
Step 4: Confirm packages are properly installed
# /usr/java/jdk/bin/java -version (To check the java version)
5. Installing Apache tomcat:
Step 1: Download selected version from http://tomcat.apache.org (File will be like apache-tomcat-.tar.gz)
Step 2: Untar the file
# tar xvzf apache-tomcat-.tar.gz
Step 3: Setup JAVA Home
# JAVA_HOME=/usr/java/default ./startup.sh (To Start Tomcat)
# JAVA_HOME=/usr/java/default ./shutdown.sh (To Stop Tomcat)
Step 4: To Enable headless mode:
File: /usr/local/tomcat/bin/catalina.sh (add near the top)
CATALINA_OPTS="-Djava.awt.headless=true"
Step 5 : Open testing page and check result
Open page http://IPADDRESS:8080 for test
6.Installing Apache Webserver:
Step 1: Download Apache http server from http://httpd.apache.org (File will be like httpd-.tar.gz)
Step 2: # tar zxvf httpd-.tar.gz
Step 3: # cd httpd-
Step 4: # ./configure --enable-MODULE=shared --enable-so --with-mpm=worker
Step 5: # make
Step 6: # make install
Step 7: Files to be configured for any changes are /etc/httpd/conf/httpd.conf
Step 8 : open testing page and check result
Open page http://IPADDRESS:80 for test
7. Installing tomcat connector:
Step 1: Download mod_jk from http://tomcat.apache.org (File will be like mod_jk-.so )
Step 2: # cp mod_jk-.so /apache2/modules
#[//apache2/modules/]# ln –s mod_jk-.so mod_jk.so
Step 3: Configuration:
create a new file with the name mod_jk.conf and workers.properties and add the below lines
# vi mod_jk.conf
#Specific workers.properties file
#LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
JkMount /servlet/* worker1
JkMount /*.jsp worker1
JkMount /*.do worker1
JkMount /sso/* worker1
# vi httpd.conf
Add below into httpd.conf
LoadModule jk_module modules/mod_jk.so
Include conf/mod_jk.conf
# vi workers.properties
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
Step 4: Restart Apache:
# /apache/bin
# ./apachectl start (To Start apache services)
# ./apachectl stop (To Stop apache services)

Sunday, December 19, 2010

Boot Sequence of Linux

Linux Boot Sequence:
Reboot/Poweron --> SMPS(Switched mode powersupply) --> Processor --> BIOS --> MBR(MasterBootRecord) --> GRUB/LILO ---> /etc/inittab --> /etc/motd
Reboot/Poweron --> Switch on or reboot the system
SMPS(Switched mode power supply)--> It is an electronic power supply that incorporates a switching regulator in order to be highly efficient in the conversion of electrical power.An SMPS is usually employed to efficiently provide a regulated output voltage, typically at a level different from the input voltage.
Processor --> the unit that reads and executes program instructions.
BIOS (Basic Input Output System) --> The BIOS software is built into the PC, and is the first code run by a PC when powered on. The primary function of the BIOS is to load and start an operating system.It Will initialize POST and Bootable Media devices
POST- Power On self test --> It will check whether all the peripheral devices are properly connected.
Bootable Media Devices --> It will check the bootable devices like cdrom etc are connected properly.
MBR(Master Boot Record)--> It is first sector of first partition which will initiate GRUB/LILO.It is 512 bytes (446byte for Executable codes and logmessages,64 bytes for Partition table information,2 bytes for Magic number).On 446 bytes loads the Kernel and initrd,64 bytes is divided into 4 Partition by defaultm in which first 3 are primary partition and 1 for Extendable partition.MBR uses virtual filesystem called NASH file systems from MBR to GRUB
/boot is an active partition or primary partition.
MBR will load the secondary boot loader which loads GRUB/LILO
LILO --> Linux loader , boot loader which has several limitation while booting so it is not used instead GRUB is used
GRUB --> Grand Unified Bootloader, which holds the address of kernel and initrd (path: /boot/grub/grub.conf)
/etc/initrd - contains required module to boot
/etc/inittab --> to indicate in which run level it should initialize
Runlevel -->
0 - halt
1 - Single user mode
2 - Multiuser mode without NFS
3 - Multiuser mode with NFS
4 - Not used
5 - GUI
6- Reboot
(All Run level specification module are defined in /etc/rc/)
/etc/rc.local --> It will be used in run day jobs or scripts after booting
/etc/motd - To set message of the day.

Link to GNU/Linux pre-installation checklist

Pls follow the below link for preinstllation checklist
http://algolog.tripod.com/lnxchk.htm

Thursday, December 16, 2010

Linux: The Basics

Linux is an operating system that can be downloaded free and "belongs" to an entire community of developers, not one corporate entity. In other words, anyone from professional software developers to hobbyist computer hackers can access and make changes to the Linux kernel—all the information about Linux is open and available to everyone. That's why Linux is known as "open source" or "free software," because there is nothing secret about this system. This freedom also allows companies to sell and distribute Linux on CD-ROM or by other means, although those companies must keep their code open to the public.
With more and more people looking for an alternative to Windows, Linux has recently grown in popularity and is quickly becoming a favorite among major corporations and curious desktop users. Not only does it give users a choice of operating systems, it also proves itself valuable with its power, flexibility, and reliability.

How did Linux get started

The concept of open source programming has been around for many years—its roots stem from universities that needed to be able to share information as well as allow students and developers to adapt programs to meet their needs. In 1984, Richard Stallman, a researcher at the MIT AI Lab, started a project he called GNU to counter the fast-moving trend toward proprietary, fee-based software. Stallman, who remains an open advocate of open source, believes that making source code available to anyone who wants it is integral to furthering computer science and innovation.
This concept served as the basis of Linux development, the brainchild of Linus Torvalds. When Torvalds began developing Linux in 1991, he was a student at the University of Helsinki and originally targeted Linux at the Intel 386 (although it is now one of the most widely ported operating systems available for PCs). Torvalds wanted to write a new version of UNIX, so he and a group of programmers combined talents and created a core operating system called Linux.

Introduction to Linux

Linux is no longer only for hobbyist hackers who dig so deep into computer code that it gets caught under their fingernails like gardening soil. With the success of a growing number of companies like Red Hat that develop and package open source programs, Linux has found its way onto the servers and desktops of major corporations as well as personal computers. It offers one of the most powerful and reliable systems available—and as an open source system, it can be altered to meet the needs of its users.