Вы находитесь на странице: 1из 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 don/t 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.
runlevels $ ists 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. (or example, '*. specifies that the process should be started in
runlevels ', *, and ..
action $ 5escribes which action should be taken. 6alid actions are listed below
o respawn $ The process will be restarted whenever it terminates.
o wait $ The process will be started once when the specified runlevel is entered and
init will wait for its termination.
o once $ The process will be executed once when the specified runlevel is entered
o boot $ The process will be executed during system boot. The runlevels field is
ignored.
o bootwait $ &ame as "boot" above, but init waits for its termination.
o off $ This does nothing.
o ondemand $ This process will be executed whenever the specified ondemand
runlevel is called.
o initdefault $ &pecifies the runlevel which should be entered after system boot. "f
none exists, init will ask for a runlevel on the console. The process field is
ignored.
o sysinit $ The process will be executed during system boot. "t will be executed
before any boot or bootwait entries. The runlevels field is ignored.
o powerwait $ The process will be executed when init receives the &"789R signal.
"nit will wait for the process to finish before continuing.
o powerfail $ &ame as powerwait but init does not wait for the process to complete.
o powerokwait $ The process will be executed when init receives the &"789R
signal provided there is a file called "/etc/powerstatus" containing the word ":;".
This means that the power has come back again.
o ctrlaltdel $ This process is executed when init receives the &"7",T signal. This
means someone on the system console has pressed the "<TR$AT$5=" key
combination.
o kbre4uest $ 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.
o process $ &pecifies the process to be executed. "f the process starts with the />/
character, init will not do utmp and wtmp accounting for that process.
Sin!le User $ode
&ingle user mode is useful to fix some system problem. (ollowing are steps you need to
use to boot 7rub boot loader into single user mode.
Procedure: %oot Linux &ru" %oot Loader into sin!le user mode
-'0 At grub boot screen -after restart0
-*0 &elect the kernel
-.0 8ress the e key to edit the entry
-10 &elect second line -the line starting with the word kernel0
-20 8ress the e key to edit kernel entry so that you can append single user mode
-%0 Append the letter & -or word &ingle0 to the end of the -kernel0 line
-?0 8ress =,T=R key
-@0 ,ow press the b key to boot the inux kernel into single user mode
-A0 9hen prompted give root password and you be allowed to login into single user mode.
Result)
Thus the linux installation was done successfully.
'.Installin! $(S)L on $icroso#t *indo+s
Aim:
To installin! $,S)L on $icroso#t *indo+s.
Procedure:
+y&B "nstallation ayout on +icrosoft 9indows
"nstalling +y&B on +icrosoft 9indows Csing the +&" 8ackage
$(S)L Installation La(out on $icroso#t *indo+s
(or +y&B 2.' on 9indows, the default installation directory is <)D8rogram
(ilesD+y&BD+y&B &erver 2.'. &ome 9indows users prefer to install in <)Dmys4l, the
directory that formerly was used as the default. Eowever, the layout of the subdirectories
remains the same.
(or +y&B 2.'.*. and earlier, all of the files are located within the parent directory,
using the structure shown in the following table.
Installation La(out #or *indo+s Usin! $(S)L -.1.'. and /arlier
0irector( 1ontents o# 0irector(
bin <lient programs and the m(s2ld server
data og files, databases
5ocs +anual in <E+ format
examples =xample programs and scripts
include "nclude -header0 files
lib ibraries
scripts Ctility scripts
share
+iscellaneous support files, including error messages, character set files, sample
configuration files, &B for database installation
(or +y&B 2.'.*1 and later, the default location of data directory was changed. The remainder
of the directory structure remains the same.
Installation La(out #or *indo+s Usin! $(S)L -.1.'3 and later
0irector( 1ontents o# 0irector(
bin <lient programs and the m(s2ld server
<)D5ocuments and &ettingsDAll
CsersDApplication 5ataD+y&B
og files, databases -9indows 38, 9indows &erver
*##.0
<)D8rogram5ataD+y&B og files, databases -9indows ?, 9indows &erver *##@0
5ocs +anual in <E+ format
examples =xample programs and scripts
include "nclude -header0 files
lib ibraries
scripts Ctility scripts
0irector( 1ontents o# 0irector(
share
+iscellaneous support files, including error messages,
character set files, sample configuration files, &B for
database installation
Installation o# $(S)L Server
Cn!ip the setup file and execute the downloaded $SI file. (ollow the instructions below exactly
when
installing +y&B &erver)
1on#i!ure $(S)L Server
"f you checked the 1on#i!ure te $(S)L Server no+ check box on the final dialog of the
+y&B
&erver installation, then the $(S)L Server Instance 1on#i!uration *i4ard will automatically
start.
(ollow the instructions below carefully to configure your +y&B &erver to run correctly with
=vent&entry.
&elect 0etailed 1on#i!uration
"t is recommended that you use a 0edicated $(S)L Server $acine for your
+y&B database, if this is not an option then select "&erver +achine".
"f you selected 0edicated $(S)L Server $acine and your +y&B
service does not start after the wi!ard completes, then try to re$run the
wi!ard -or re$install0 +y&B, but this time select the Server $acine
option.
&elect Transactional 0ata"ase Onl(, this will make sure that
Inno0% is the main storage engine.
&elect the drive where the database files will be stored.
&elect the drive on the fastest drive-s0 on your server.
=nter the
=nter the number of agents you are monitoring, multiplied by two.
(or example, if you are monitoring *# servers then enter 35.
"t is recommended that you leave the default port ..56 in place, however
=vent&entry will also work with non$standard ports if necessary.
&elect the Standard 1aracter Set for =vent&entry
"t is i!l( recommended that you run the +y&B &erver as a 9indows
service and include the binary directory in the search path.
&pecify a secure root password, you may want to check the box /na"le root access
#rom remote macines if you plan on administering your $(S)L server
from your workstation or other servers.
"f you see this dialog then your instance was setup correctly.
Result)
Thus the +ys4l installation was done successfully.
.. Apace Installation
Aim:
To install Apace Server in *indo+s.
Procedure:
Apace '.'.X
1. 0o+nload 7 Unpac8
7o to http)//www.apache.org/dist/httpd/binaries/win.*/ and choose a mirror. Fou want
the latest +in.'9x:69no;ssl.msi "+&" "nstaller 8ackage" release.
+y file was named) apache_2.2.11-win32-x86-no_ssl.msi
,:T=
Apache sometimes moves the "4uick download" link to the win.* binary. The long way to
officially find it is 5ownload G Oter #iles G "inaries folder -not the "Hinary Releases"
info link at the top0 G +in.' folder G then the latest +in.'9x:69no;ssl.msi release
'. Install
9hen you install Apache, you/ll get a prompt for "&erver "nformation." Eere is the
settings " used)
,etwork 5omain) localhost
&erver ,ame) localhost
Admin =mail) -any email. real or fake0
Icec8edJ) for All Csers, on 8ort @#, as a &ervice
.. Startin!<Stoppin! Apace
After installing, Apache* automatically starts. The icon in the &ystem Tray means it
started. The icon means the "+onitor Apache &ervers" is running, but Apache* isn/t
started.
Fou can easily start/stop/restart Apache and Apache* via that icon in your &ystem Tray. "f
you get "The re4uested operation has failedK" error while starting apache use the "Test
<onfiguration" shortcut in the &tart +enu to find the error -if the text window pops up
then closes before you can read it, your config file is fine0.
3. Testin!
,ow the ultimate test. To see if it/s serving. :pen your browser and head to)
http)//'*?.#.#.'/ or http)//localhost/
"f it shows the It works! you have your server software installed and running.
-. $a8in! Apace point to (our #iles
Csing ,otepad open <)/8rogram (iles/Apache &oftware
(oundation/Apache*.*/conf/httpd.conf -in the start$menu there should also be a "Apache
HTTP Server 2.2 > on!i"#re Apache Server > $%i& &he Apache h&&p%.con! on!i"#ra&ion
'ile" shortcut0 and search for 0ocumentRoot. <hange it from something like
0ocumentRoot =1:<Pro!ram >iles<Apace So#t+are >oundation<Apace'.'<tdocs=
to the location where your ET+ files and site are located. "n my case) 0ocumentRoot
=1:<pu"lic;tml=
,:T=
The first time i installed Apache*, i accidentally changed &erverRoot. +ake sure you
change the correct line which is 0ocumentRoot and which is down about line '2#.
%. Then scroll down about one page and change) ?0irector( =1:<Pro!ram >iles<Apace
So#t+are >oundation<Apace'.'<tdocs=@ to point to the same location you set
5ocumentRoot to in the last step. Restart apache to make the changes take effect
Result)
Thus the Apache &erver installation was done successfully.
3 . PAP +it 0ata"ase connectivit(
Aim:
To implement te PAP Pro!ram +it 0ata"ase 1onnectivit(.
Procedure:
"n this 8rogram <reate the (ollowing . (iles
&tep ') <reate ogin 8age-Eome8age.php0
&tep *) <reate 6alidation 8age-checklogin.php0
L,ote ) All the files store under the c)DwampDwww directory before that install 9amp&erver
%e#ore Tat 1reate Ta"le
<lick The following CR
http)//localhost/phpmyadmin/
pp$(Admin
1reate data"ase usin! pp$(Admin
1reate ne+ data"ase #orm
'. To create new database use this form, type database name then click "<reate" button. "n this
example " create database name "testMcreateM5H".

1reate ta"le
1reate ta"le #orm
'. After created database. this form/ll be display. =nter the name of table and number of field. "n
this example, " create table name "webMmembers" for store my web members and it have 1
fields -id, name, lastname, email0
Result a#ter created ta"le on data"ase
1reate ta"le "( runin! S)L 2uer(
S)L Pa!e
'. Fou can create table by run &B 4uery for example, put this code in the form and click "7o"
<R=AT= TAH= NwebMmembersN -
NidN int-10 ,:T ,C autoMincrement,
NnameN varchar-%20 ,:T ,C default //,
NlastnameN varchar-%20 ,:T ,C default //,
NemailN varchar-%20 ,:T ,C default //,
8R"+ARF ;=F -NidN0
0 TF8=O+y"&A+ ACT:M",<R=+=,TO' P
1reate Lo!in Pa!eBAomePa!e.ppC
Qtable widthO".##" borderO"#" alignO"center" cellpaddingO"#" cellspacingO"'"
bgcolorO"R<<<<<<"G
QtrG
Qform nameO"form'" methodO"post" actionO"checklogin.php"G
QtdG
Qtable widthO"'##S" borderO"#" cellpaddingO"." cellspacingO"'" bgcolorO"R(((((("G
QtrG
Qtd colspanO"."GQstrongG+ember ogin Q/strongGQ/tdG
Q/trG
QtrG
Qtd widthO"?@"GCsernameQ/tdG
Qtd widthO"%"G)Q/tdG
Qtd widthO"*A1"GQinput nameO"myusername" typeO"text" idO"myusername"GQ/tdG
Q/trG
QtrG
QtdG8asswordQ/tdG
QtdG)Q/tdG
QtdGQinput nameO"mypassword" typeO"text" idO"mypassword"GQ/tdG
Q/trG
QtrG
QtdGTnbspPQ/tdG
QtdGTnbspPQ/tdG
QtdGQinput typeO"submit" nameO"&ubmit" valueO"ogin"GQ/tdG
Q/trG
Q/tableG
Q/tdG
Q/formG
Q/trG
Q/tableG
Or
BLo!inPa!e.tmlC
QhtmlG
QtitleGoginQ/titleG
QbodyG
Qform nameO"+F (orm" method O "post" actionO"http)//localhost/checklogin.php"G
userid Qinput typeO"text"nameO"myusername"G
QbrGpasswordQinput typyO"password" nameO"mypassword"G
QbrG
Qinput typeO"submit"nameO"button'"valueO"login"G
Q/formG
Q/bodyG
Q/htmlG
1reate Dalidation Pa!eBcec8lo!in.ppC
QUphp
VhostO"localhost"P // Eost name
VusernameO"root"P // +ys4l default username
//VpasswordO""P // +ys4l ,o password
VdbMnameO"myMdb"P // 5atabase name
VtblMnameO"members"P // Table name
// <onnect to server and select databse.
mys4lMconnect-"Vhost", "Vusername"0or die-"cannot connect"0P
mys4lMselectMdb-"VdbMname"0or die-"cannot select 5H"0P
// username and password sent from form
VmyusernameOVM8:&TI/myusername/JP
VmypasswordOVM8:&TI/mypassword/JP
Vs4lO"&==<T L (R:+ VtblMname 9E=R= usernameO/Vmyusername/ and
passwordO/Vmypassword/"P
VresultOmys4lM4uery-Vs4l0P
// +ys4lMnumMrow is counting table row
VcountOmys4lMnumMrows-Vresult0P
// "f result matched Vmyusername and Vmypassword, table row must be ' row
if-VcountOO'0
echo "9elcome To :ur 9eb 8age"P
else
echo "9rong Csername or 8assword"P
UG
Output:
EAll te source Pro!ram availa"le in Pp>iles.
Result)
Thus the 8E8 with 5atabase <onnectivity was done successfully.
-. PA,TON pro!rammin!
Aim:
To +rite a Simple Pro!ram >or Implemenation o# P(ton.
Procedure:
/xample 1: Simple Pro!ram
BAello *orld Pro!ramC
Step 1:
Eello.py
nameOrawMinput-"8lease =nter Cr ,ame O "0
print "Eello",name," 7ood To &ee C"
Step ':

<hoose Run $ G Run +odules
Output:
GGG
8lease =nter Cr ,ame O aravind
Eello aravind 7ood To &ee C
/xample ': $odule Pro!ram
B>i"onacci SeriesC
A module is a file containing 8ython definitions and statements. The file name is the
module name with the suffix .py appended. 9ithin a module, the moduleWs name -as a string0 is
available as the value of the global variable MMnameMM. (or instance, use your favorite text editor
to create a file called fibo.py in the current directory with the following contents)
Step 1:
(ibo.py
def fib-n0) R write (ibonacci series up to n
a, b O #, '
while b Q n)
print b,
a, b O b, a>b
Step ':
GGG import fibo
Step .:
GGG fibo.fib-'###0
' ' * . 2 @ '. *' .1 22 @A '11 *.. .?? %'# A@?
EAll te P(ton Pro!ram availa"le in P(ton>iles >older
Result)
Thus the 8ython programs was executed T The Result was verified.
6. Perl Scripts and 1&I
Aim:
To write script 8rogram by using 8erl.
Procedure:
'. "nstall Active8erl ver 2.'#.#.'##2
*. "nstallation path c)DwampDbinD8erl
*. After installing ActivePerl , run the +amp
server.
you need to create * files inside a new folder under +++ directory of wamp )
cgiMform.html
backatcha.cgi
then run the c!i;#orm.tml under wamp server.
=xample file )
<reate a file named c!i;#orm.tml
QhtmlG
QheadG
QtitleGQ/titleG
Q/headG
QbodyG
Qform actionO"backatcha.cgi" methodO"7=T"G
QpG9hat is your favorite colorU
Qinput nameO"favcolor" /GQ/pG
Qinput typeOsubmit valueO"&end form" /G
Q/formG
Q/bodyG
Q/htmlG
<reate a file named "ac8atca.c!i
RK<)DwampDbinD8erlDbinDperl.exe
use 2.#'#P
use <7"P
use strictP
use warningsP
my V4 O <7"$Gnew-0P
say V4$Gheader-0, V4$GstartMhtml-0P
say "Qh'G8arametersQ/h'G"P
for my Vparam -V4$Gparam-00 X
my VsafeMparam O V4$GescapeET+-Vparam0P
say "QpGQstrongGVsafeMparamQ/strongG) "P
for my Vvalue -V4$Gparam-Vparam00 X
say V4$GescapeET+-Vvalue0P
Y
say /Q/pG/P
Y
say V4$GendMhtml-0P
then , run the +amp server ,
and open the c!i;#orm.tml
- for example ) ttp:<<localost<c!i<c!i;#orm.tml 0
cgiMform
cgiMresult

LAll the <7" &cripts contains 8erl(iles (older
Settin! Up Perl and 1&I >or *amp Server
Step1:
(irst you need to download 9amp &erver from www.wampserver.com and install 9amp &erver
on your machine. The default installation directory is Z()wamp[ and here " am using the default
options for installation. To complete the installation you have to set the host name for your mail
server and your email address, here you can leave the default option again. That will do no harm.
The current 9amp &erver will install Apache *.*.'', 8E8 2.*.A$* > 8=<, +y&B 2.'...,
&Bitemanager and 8hp+yadmin.
Step':
,ow you have to download Active8erl -currently 2.'#.#0 from www.activestate.com and install
it. The default installation directory is \()Perl\, but for simplicity and ease of use " use different
directory. " create a new folder name \perl[ inside \()wamp)*in\. &o " install Active 8erl in
\()wamp)*in)perl[ directory. The next thing you need to do is configure the Apache web server
to execute 8erl and <7" script.
Step.:
This is the most important part here. Fou need to edit the Apache configuration file. ,ow go to
\()wamp)*in)apache)Apache2.2.11)con![ directory and open \h&&p%.con![ file. =dit the
httpd.conf file as below.
'. "nside h&&p%.con!, look for the line that says \+,irec&or- .c(/wamp/www/0>\, ]ust a few lines
below this youWll find the line that says \1p&ions 2n%exes 'ollowS-m3in4s\. Add \2ncl#%es
$xec52[ in the line ]ust next to (ollow&yminks, thus it look like this
'. :ptions "ndexes (ollow&yminks "ncludes =xec<7"
This will enable <7" script inside your www folder.
*. ,ow look for the line \A%%Han%ler c"i-scrip& .c"i\, this line is commented out. Fou need to
enable this by un$comment this line, to do that remove the R character at the beginning of this
line. This will add handler for files with .cgi extension. "f you want to use .pl file extension in
your server add \AddEandler cgi$script .pl[ ]ust below the above line. ,ow you will be able to
execute <7" and 8erl script with .cgi and .pl, extension.
ines to add
'. AddEandler cgi$script .cgi
*. AddEandler cgi$script .pl
.. To add directory index file, look for the line \,irec&or-2n%ex in%ex.php in%ex.php3 in%ex.h&ml
in%ex.h&m\. Add in%ex.c"i and in%ex.pl in this line.
ines to add
'. 5irectory"ndex index.php index.php. index.html index.htm index.cgi index.pl
Al&erna&ive( "f you do not want to waste your time doing the above . steps, you can download
the edited configuration file httpd.conf here. Replace the one inside your apache directory with
this one.
Step3:
Four server is now configured and ready to run perl and cgi script.
Alternative: "f you donWt want to waste your time doing the above . steps, you can copy the
edited httpd.conf file-in the cd0. Repalce the one is inside your apache directory with this one.
Result)
Thus the 8erl 8rogramming =ditor was installed successfully.
F.Net+or8 simulator BNS'C installation and simple tcl scripts
Aim:
To install te Ns' 7 Simple T1L
Procedure:
NS '..5 installation !uide
'. "nstall cygwin setup.
*. click ,ext button.
.. &elect "nstall from ocal 5irectory option.
1. <lick ,ext button.
2. <lick ,ext button.
%. Cncheck Eide obsolete and administrative packages option and click the 6iew button
from top.
?. <lick ,ext button.
@. <lick over the word &kip under column ,ew.
A. <lick ,ext button.
'#. <lick (inish button.
''. <lick ok button to complete.
'*. 7o to &tart All 8rograms <ygwin <ygwin Hash shell.
'.. <opy and 8aste the content of ns$allinone$*..# folder into location c)DcygwinDhomeD
'1. "n the cygwin bash shell key in the command cd ..
'2. Type cd ns$allinone$*..#/ns$*..#
'%. Type in ./configure
'?. Type make.
'@. Type make install.
'A. Type cd..
*#. Type cd nam$'.'*.
*'. Type ./configure
**. Type make.
*.. Type make install.
*1. Type =xit
NS '..5 startup !uide
'. &tart cygwin bash shell.
*. Type startx that leads to the netsim window.
.. Type cd..
1. Type cd 8rograms
2. To open any file type ns filename.tcl
%. "n the simulator window press the play button to run the file.
?. Type exit to close the window.
,ote)
Cse wordpad application to open the .tcl files.
EAll T1L #iles contains GNS' >ilesGT1L /xamples >older
Result)
Thus the ,&* installation was done successfully.

Вам также может понравиться