44
1.LINUX INSTALLATION Aim: To install the linux in various modes. Procedure Linux Start up and Run Levels Te Init Pro!ram As seen in the previous section, the kernel will start a program called init, if it finds it. The init  process reads the file "/etc/inittab" and uses this file to determine how to create processes. Read the init man page for more information. Also note that init is always running and can dynamically do things and run processes based upon various signals. The administrator can also cause it to dynamically change system processes and runlevels by using the telinit program or editing the "/etc/inittab" file. Runlevels inux utili!es what is called "runlevels". A runlevel is a software configuration of the system that allows only a selected group of processes to exist. nit can run the system in one of eight runlevels. These runlevels are #$% and & or s. The system runs in only one of these runlevels at a time. Typically these runlevels are used for different purposes. Runlevels #, ', and % are reserved. (or Redhat inux version %, the runlevels are) # $ halt ' $ &ingle user mode * $ +ultiuser, without (& -The same as , if you dont have networking0 $ (ull multiuser mode 1 $ unused 2 $ 3'' % $ Reboot Te initta" #ile The "/etc/inittab" file tells init which runlevel to start the system at and describes the processes to  be run at each runlevel. An entry in the inittab file has the following format) id:runlevels:action:process id $ A uni4ue se4uence of '$1 characters which identifies an entry in inittab.

Open Source Software Lab Manual

Embed Size (px)

Citation preview

1

1.LINUX INSTALLATION

Aim:

To install the linux in various modes.

Procedure

Linux Start up and Run Levels

The Init Program

As seen in the previous section, the kernel will start a program called init, if it finds it. The init process reads the file "/etc/inittab" and uses this file to determine how to create processes. Read the init man page for more information. Also note that init is always running and can dynamically do things and run processes based upon various signals. The administrator can also cause it to dynamically change system processes and runlevels by using the telinit program or editing the "/etc/inittab" file.

Runlevels

Linux utilizes what is called "runlevels". A runlevel is a software configuration of the system that allows only a selected group of processes to exist. Init can run the system in one of eight runlevels. These runlevels are 0-6 and S or s. The system runs in only one of these runlevels at a time. Typically these runlevels are used for different purposes. Runlevels 0, 1, and 6 are reserved. For Redhat Linux version 6, the runlevels are:

0

-

halt

1

-

Single user mode

2

-

Multiuser, without NFS (The same as 3, if you don't have networking)

3

-

Full multiuser mode

4

-

unused

5

-

X11

6

-

Reboot

The inittab file

The "/etc/inittab" file tells init which runlevel to start the system at and describes the processes to be run at each runlevel. An entry in the inittab file has the following format:

id:runlevels:action:process id - A unique sequence of 1-4 characters which identifies an entry in inittab.

runlevels - Lists the runlevels for which the specified action should be taken. This field may contain multiple characters for different runlevels allowing a particular process to run at multiple runlevels. For example, 123 specifies that the process should be started in runlevels 1, 2, and 3.

action - Describes which action should be taken. Valid actions are listed below

respawn - The process will be restarted whenever it terminates.

wait - The process will be started once when the specified runlevel is entered and init will wait for its termination.

once - The process will be executed once when the specified runlevel is entered

boot - The process will be executed during system boot. The runlevels field is ignored.

bootwait - Same as "boot" above, but init waits for its termination.

off - This does nothing.

ondemand - This process will be executed whenever the specified ondemand runlevel is called.

initdefault - Specifies the runlevel which should be entered after system boot. If none exists, init will ask for a runlevel on the console. The process field is ignored.

sysinit - The process will be executed during system boot. It will be executed before any boot or bootwait entries. The runlevels field is ignored.

powerwait - The process will be executed when init receives the SIGPWR signal. Init will wait for the process to finish before continuing.

powerfail - Same as powerwait but init does not wait for the process to complete.

powerokwait - The process will be executed when init receives the SIGPWR signal provided there is a file called "/etc/powerstatus" containing the word "OK". This means that the power has come back again.

ctrlaltdel - This process is executed when init receives the SIGINT signal. This means someone on the system console has pressed the "CTRL-ALT-DEL" key combination.

kbrequest - The process will be executed when init receives a signal from the keyboard handler that a special key combination was pressed on the console keyboard.

process - Specifies the process to be executed. If the process starts with the '+' character, init will not do utmp and wtmp accounting for that process.

Single User Mode

Single user mode is useful to fix some system problem. Following are steps you need to use to boot Grub boot loader into single user mode.

Procedure: Boot Linux Grub Boot Loader into single user mode

(1) At grub boot screen (after restart)

(2) Select the kernel

(3) Press the e key to edit the entry

(4) Select second line (the line starting with the word kernel)

(5) Press the e key to edit kernel entry so that you can append single user mode

(6) Append the letter S (or word Single) to the end of the (kernel) line

(7) Press ENTER key

(8) Now press the b key to boot the Linux kernel into single user mode

(9) When prompted give root password and you be allowed to login into single user mode.

Result:

Thus the linux installation was done successfully.

2.Installing MySQL on Microsoft Windows

Aim:

To installing MYSQL on Microsoft Windows.

Procedure: MySQL Installation Layout on Microsoft Windows Installing MySQL on Microsoft Windows Using the MSI PackageMySQL Installation Layout on Microsoft Windows

For MySQL 5.1 on Windows, the default installation directory is C:\Program Files\MySQL\MySQL Server 5.1. Some Windows users prefer to install in C:\mysql, the directory that formerly was used as the default. However, the layout of the subdirectories remains the same.

For MySQL 5.1.23 and earlier, all of the files are located within the parent directory, using the structure shown in the following table.

Installation Layout for Windows Using MySQL 5.1.23 and EarlierDirectoryContents of Directory

binClient programs and the mysqld server

dataLog files, databases

DocsManual in CHM format

examplesExample programs and scripts

includeInclude (header) files

libLibraries

scriptsUtility scripts

shareMiscellaneous support files, including error messages, character set files, sample configuration files, SQL for database installation

For MySQL 5.1.24 and later, the default location of data directory was changed. The remainder of the directory structure remains the same.

Installation Layout for Windows Using MySQL 5.1.24 and laterDirectoryContents of Directory

binClient programs and the mysqld server

C:\Documents and Settings\All Users\Application Data\MySQLLog files, databases (Windows XP, Windows Server 2003)

C:\ProgramData\MySQLLog files, databases (Windows 7, Windows Server 2008)

DocsManual in CHM format

examplesExample programs and scripts

includeInclude (header) files

libLibraries

scriptsUtility scripts

shareMiscellaneous support files, including error messages, character set files, sample configuration files, SQL for database installation

Installation of MySQL Server

Unzip the setup file and execute the downloaded MSI file. Follow the instructions below exactly when

installing MySQL Server:

Configure MySQL Server

If you checked the Configure the MySQL Server now check box on the final dialog of the MySQL

Server installation, then the MySQL Server Instance Configuration Wizard will automatically start.

Follow the instructions below carefully to configure your MySQL Server to run correctly with

EventSentry.

Select Detailed Configuration

It is recommended that you use a Dedicated MySQL Server Machine for your

MySQL database, if this is not an option then select "Server Machine".

If you selected Dedicated MySQL Server Machine and your MySQL

service does not start after the wizard completes, then try to re-run the

wizard (or re-install) MySQL, but this time select the Server Machine

option.

Select Transactional Database Only, this will make sure that

InnoDB is the main storage engine.

Select the drive where the database files will be stored.

Select the drive on the fastest drive(s) on your server.

Enter the

Enter the number of agents you are monitoring, multiplied by two.

For example, if you are monitoring 20 servers then enter 40.

It is recommended that you leave the default port 3306 in place, however

EventSentry will also work with non-standard ports if necessary.

Select the Standard Character Set for EventSentry

It is highly recommended that you run the MySQL Server as a Windows

service and include the binary directory in the search path.

Specify a secure root password, you may want to check the box Enable root access

from remote machines if you plan on administering your MySQL server

from your workstation or other servers.

If you see this dialog then your instance was setup correctly.

Result:

Thus the Mysql installation was done successfully.

3. Apache InstallationAim:

To install Apache Server in Windows.

Procedure:

Apache 2.2.X

1. Download & Unpack

Go to http://www.apache.org/dist/httpd/binaries/win32/ and choose a mirror. You want the latest win32-x86-no_ssl.msi "MSI Installer Package" release.

My file was named: apache_2.2.11-win32-x86-no_ssl.msi

NOTE

Apache sometimes moves the "quick download" link to the win32 binary. The long way to officially find it is Download > Other files > binaries folder (not the "Binary Releases" info link at the top) > win32 folder > then the latest win32-x86-no_ssl.msi release

2. Install

When you install Apache, you'll get a prompt for "Server Information." Here is the settings I used:

Network Domain: localhost

Server Name: localhost

Admin Email: (any email. real or fake)

[checked]: for All Users, on Port 80, as a Service

3. Starting/Stopping Apache

After installing, Apache2 automatically starts. The icon in the System Tray means it started. The icon means the "Monitor Apache Servers" is running, but Apache2 isn't started.

You can easily start/stop/restart Apache and Apache2 via that icon in your System Tray. If you get "The requested operation has failed!" error while starting apache use the "Test Configuration" shortcut in the Start Menu to find the error (if the text window pops up then closes before you can read it, your config file is fine).

4. Testing

Now the ultimate test. To see if it's serving. Open your browser and head to: http://127.0.0.1/ or http://localhost/

If it shows the It works! you have your server software installed and running.

5. Making Apache point to your files

Using Notepad open C:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf (in the start-menu there should also be a "Apache HTTP Server 2.2 > Configure Apache Server > Edit the Apache httpd.conf Configuration File" shortcut) and search for DocumentRoot. Change it from something like DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" to the location where your HTML files and site are located. In my case: DocumentRoot "C:/public_html"

NOTE

The first time i installed Apache2, i accidentally changed ServerRoot. Make sure you change the correct line which is DocumentRoot and which is down about line 150.

6. Then scroll down about one page and change: to point to the same location you set DocumentRoot to in the last step. Restart apache to make the changes take effect

Result:

Thus the Apache Server installation was done successfully.

4 . PHP with Database connectivity

Aim:

To implement the PHP Program with Database Connectivity.

Procedure:

In this Program Create the Following 3 Files

Step 1: Create Login Page(HomePage.php)

Step 2: Create Validation Page(checklogin.php)

*Note : All the files store under the c:\wamp\www directory before that install WampServer

Before That Create Table

Click The following URL

http://localhost/phpmyadmin/

phpMyAdmin

Create database using phpMyAdmin

Create new database form

1. To create new database use this form, type database name then click "Create" button. In this example I create database name "test_create_DB".

Create table

Create table form

1. After created database. this form'll be display. Enter the name of table and number of field. In this example, I create table name "web_members" for store my web members and it have 4 fields (id, name, lastname, email)

Result after created table on database

Create table by runing SQL query SQL Page

1. You can create table by run SQL query for example, put this code in the form and click "Go"

CREATE TABLE `web_members` (`id` int(4) NOT NULL auto_increment,`name` varchar(65) NOT NULL default '',`lastname` varchar(65) NOT NULL default '',`email` varchar(65) NOT NULL default '',PRIMARY KEY (`id`)) TYPE=MyISAM AUTO_INCREMENT=1 ;

Create Login Page(HomePage.php)

Member Login

Username

:

Password

:

Or

(LoginPage.html)

Login

userid


password


Create Validation Page(checklogin.php)