open source manual final

83
Ex.No:1 KERNEL CONFIGURATION DATE: AIM: To install and configure the kernel in linuxplatform. STEPS TO INSTALL KERNAL: STPE 1:First check current working kernel version. [fosslab@fosslab]$uname –r 2.6.35.6-45.fc14.i686 STEP 2:Download latest kernel from www.kernel.org. STEP 3:login to root user. [fosslab@fossl ab]$su Password: [root@fosslab] # STEP 4:Extract the kernel source code. [root@fosslab]#tar zxvf linux-2.6.39.2.tar.gz STEP 5: change the directory to kernel source. [root@fosslab]#cd linux-2.6.39.2 STEP 6: open the make file. [root@fosslab linux-2.6.39.2]#vi makefile Look fourth line it will be in following format. EXTRAVERSION= .2

Upload: thebhas1954

Post on 08-Apr-2016

15 views

Category:

Documents


1 download

DESCRIPTION

lab manual....

TRANSCRIPT

Page 1: Open Source Manual Final

Ex.No:1 KERNEL CONFIGURATION

DATE:

AIM: To install and configure the kernel in linuxplatform.

STEPS TO INSTALL KERNAL:

STPE 1:First check current working kernel version.

[fosslab@fosslab]$uname –r2.6.35.6-45.fc14.i686

STEP 2:Download latest kernel from www.kernel.org.

STEP 3:login to root user.

[fosslab@fosslab]$su Password: [root@fosslab]#

STEP 4:Extract the kernel source code.

[root@fosslab]#tar zxvf linux-2.6.39.2.tar.gz

STEP 5: change the directory to kernel source.

[root@fosslab]#cd linux-2.6.39.2

STEP 6: open the make file.

[root@fosslab linux-2.6.39.2]#vi makefile

Look fourth line it will be in following format.

EXTRAVERSION= .2

Now you can add –mykernel at end of this line like this

Page 2: Open Source Manual Final

EXTRAVERSION= .2-mykernel

Save and exit the file.

STEP 7: now make menu configuration.

[root@fosslab linux-2.6.39.2]#make menuconfig

Now following window is display to you.

Use down arrow to select File system --->

Then the following window is display to you.

Page 3: Open Source Manual Final

Use down arrow to select DOS/FAT/NT File systems --->Now following window is display to you.

Use down arrow and Tab to select NTFS file system support.

Page 4: Open Source Manual Final

Now extra two sub option is displayed to you, like this

Use Tab to select NTFS write support.

Exit and save the kernel configuration.

STEP 8: now make bzImage file. This will take few minutes.

[root@fosslab linux-2.6.39.2]#make bzImage

STEP 9: Now copy this bzimage to /boot/vmlinuz-2.6.39.2-mykernel.

[root@fosslab linux-2.6.39.2]#cp arch/x86/boot/bzImage /boot/vmlinuz-2.6.39.2-mykernel

STEP 10: make modules. This will take few minutes.

[root@fosslab linux-2.6.39.2]#make modules

STEP 11: Now install the modules.

[root@fosslab linux-2.6.39.2]#make modules_install

Page 5: Open Source Manual Final

STEP 12: change the directory to boot.

[root@fosslab boot]#cd boot[root@fosslabboot]#chmod 755 vmlinuz-2.6.39.2-mykernel

STEP 13: change the directory to grub.

STEP 14:now open grub.conf file.

[root@fosslab grub]#vi grub.conf

Insert following lines at end of the grub.conf file.

title Fedora (2.6.39.2-mykernel) root (hd0,0)kernel /boot/rmlinuz-2.6.39.2-mykernel ro root=UUID=1427721c-c499-445d-9653-45czd365bb9b rd_NO_LUKSrd_NO_LVMrd_NO_MDrd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quietinitrd /boot/initramfs-2.6.39.2-mykernel.img

Now Save and exit the file.

STEP 15: reboot your system.

[root@fosslab grub]#reboot

STEP 16: Now check your current kernel version.

[fosslab@fosslab]$uname –r

RESULT:Thus the kernel was successfully installed and configured.

Page 6: Open Source Manual Final

Ex.No:2 VIRTUALISATION

DATE:

AIM:Virtualisation environment (e.g., xen, kqemu or lguest) to test an

applications,new kernels and isolate applications.

STEPS FOR VIRTUALIZATION USING QEMU AND FREEDOS:

STEP 1:Download the fdbasecd.iso from www.freedos.org (or) from fosslab server.The following steps should be followed from the directory where fdbasecd.iso is stored.

STEP 2:create virtualdisk.

[fosslab@fosslab]$qemu-img create virtualdisk.img 100M

STEP 3: boot the disk.

[fosslab@fosslab]$qemu -hdavirtualdisk.img -cdrom fdbasecd.iso -boot d

Select 1to boot from CDROM

Page 7: Open Source Manual Final

STEP 4:select 1 for Install to harddisk using FreeDOS SETUP(Default).

STEP 5:select language-English(US).

Page 8: Open Source Manual Final

STEP 6:now select Run FreeDOS from CD-ROM(return to command prompt)

STEP 7:typefdisk in following window.

Page 9: Open Source Manual Final

STEP 8:Enable Large disk support (Y).

STEP 9:select create DOS partition or logical DOS Driver.

Page 10: Open Source Manual Final

STEP 10: select create primary DOS partition.

STEP 11:selectyes from following window.

Page 11: Open Source Manual Final

STEP 12:primary DOS partition created.

RESULT:

The virtual hard disk primary DOS partition is successfully created

Page 12: Open Source Manual Final

Ex.No:3 COMPILING FROM SOURCE

DATE:

AIM:To Installing webattery for compiling from source.

STEPS FOR INSTALLING WEBATTERY:

STEP 1:download webbattery from following link.

http://pkgs.org/contos-5-rhel-5/epel-i386/webattery-1.2-6.e15.src.rpm/download/

STEP 2: Move downloaded file to /home/fosslab folder.

[fosslab@fosslab]$mv Downloads/webattery-1.2-6.e15.src.rpm /home/fosslab

STEP 3:change directory to /home/fosslab.

[fosslab@fosslab]$cd /home/fosslab

[fosslab@fosslab]$rpm –ivh webatter-1.2-6.e15.src.rpm

The above command creates a directory rbmbuildunder the home folder /home/fosslab/

Example:/home/fosslab/rpmbuild

STEP 4:change directory.

[fosslab@fosslab]$cd /home/fosslab/rpmbuild/SOURCES/

STEP 5:Extract the source file using the command.

[fosslab@fosslab SOURCES]$tar zxvf webattery-1.2.tar.gz

STEP 6: now following steps are perform by root user.so,login to root user.

Page 13: Open Source Manual Final

[fosslab@fosslab]$su Password: [root@fosslab]#

STEP 7: change the directory.

[root@fosslab]#cd /home/fosslab/rpmbuild/SOURCES/

[root@fosslab SOURCES]#cd webattery-1.2/

STEP 8:check for the necessary tools/libraries for the build environment and creates the makefile.

[root@fosslab webattery-1.2]#./configure

STEP 9:compile all the source files and create the executable binaries using following command.

[root@fosslab webattery-1.2]#make

STEP 10: now install webattery.

[root@fosslab webattery-1.2]#make install

STEP 11: now verify webattery is installed or not.

[root@fosslab]#which webattery /usr/local/bin/webattery

RESULT:The webattery is successfully installed in Linux.

Page 14: Open Source Manual Final

Ex.No:3 INTRODUCTION TO PACKET MANAGEMENT SYSTEM

DATE:

AIM:

To configure the packet management and implement using our own

repository so that client can access the package from our repository.

PROCEDURE:

1. Load the necessary packages for creating the repository.

2. Check for the package createrepo which is necessary for creating repository.

3. Using the command “ createrepo foldername/ “ create repodata.

4. Copy the folder to the location “ /var/www/html/foldername/ “

5. Create a repo file “ filename.repo” in the directory “ /etc/yum.repodata/ “. In

the repo file include the path of the repodata folder as the baseurl.

6. Using the command “ yum clean all “ clean up all the previous cache.

7. Update the cache using the command “ yum repolist “.

8. The package added will be included in the repo list. It can be accessed using

the corresponding url path “ http://localhost/foldername/ “.

9. Install the package using the command yum install package name.

10. Exit the terminal and browser.

[root@localhost ~]# cd Desktop/

[root@localhost Desktop]# rpm -q createrepo

createrepo-0.9.8-5.fc14.noarch

[root@localhost Desktop]# createrepo qmail/

Saving Primary metadata

Page 15: Open Source Manual Final

Saving file lists metadata

Saving other metadata

[root@localhost Desktop]# ls -l /var/www/html/

total 4

-rw-r--r--. 1 root root 3 Jul 25 20:48 test.txt

[root@localhost Desktop]# mv qmail/ /var/www/html/

[root@localhost Desktop]# service httpd start

Starting httpd: [ OK ]

[root@localhost Desktop]# ls -l /var/www/html/

total 20

drwxr-xr-x. 3 root bin 16384 Jul 25 21:08 qmail

-rw-r--r--. 1 root root 3 Jul 25 20:48 test.txt

[root@localhost Desktop]# chmod 777 /var/www/html/qmail/

[root@localhost Desktop]# ls -l /var/www/html/

total 20

drwxrwxrwx. 3 root bin 16384 Jul 25 21:08 qmail

-rw-r--r--. 1 root root 3 Jul 25 20:48 test.txt

[root@localhost Desktop]# createrepo qmail/

Saving Primary metadata

Saving file lists metadata

Saving other metadata

[root@localhost Desktop]# pwd

/root/Desktop

[root@localhost Desktop]# cp fuse-2.8.5-5.fc14.i686.rpm

/var/www/html/repo/recital/updates/

[root@localhost Desktop]# createrepo -v -s md5

/var/www/html/repo/recital/updates/

1/1 - fuse-2.8.5-5.fc14.i686.rpm

Saving Primary metadata

Page 16: Open Source Manual Final

Saving file lists metadata

Saving other metadata

[root@localhost Desktop]# ls -l /var/www/html/repo/recital/updates/total 76

-rwxr-xr-x. 1 root root 72836 Jul 25 21:23 fuse-2.8.5-5.fc14.i686.rpm

drwxr-xr-x. 2 root root 4096 Jul 25 21:23 repodata

[root@localhost Desktop]# ls -l /var/www/html/repo/recital/updates/repodata/

total 16

-rw-r--r--. 1 root root 445 Jul 25 21:23 filelists.xml.gz

-rw-r--r--. 1 root root 672 Jul 25 21:23 other.xml.gz

-rw-r--r--. 1 root root 996 Jul 25 21:23 primary.xml.gz

-rw-r--r--. 1 root root 1142 Jul 25 21:23 repomd.xml

[root@localhost Desktop]# verifytree /var/www/html/repo/recital/updates/

Loaded plugins: langpacks, presto, refresh-packagekit

Adding en_US to language list

Checking repodata:

verifying repomd.xml with yum

verifying filelists checksum

verifying other checksum

verifying primary checksum

Checking groups (comps.xml):

verifying comps.xml with yum

comps file missing or unparseable

[root@localhost Desktop]# cd /etc/yum.repos.d

[root@localhost yum.repos.d]# ls

fedora.repo fedora-updates-testing.repo

fedora-updates.repo packagekit-media.repo

[root@localhost yum.repos.d]# vi fuse.repo

[Fuse]

name=Fuse G

Page 17: Open Source Manual Final

baseurl=http://localhost/repo/recital/updates/

enabled=1

gpgcheck=1

:wq

[root@localhost yum.repos.d]# yum repolist

Loaded plugins: langpacks, presto, refresh-packagekit

Adding en_US to language list

Fuse | 1.1 kB 00:00

Fuse/primary | 996 B 00:00

Fuse 1/1

fedora | 1.3 kB 00:00 ...

fedora/primary | 176 B 00:00

[root@localhost yum.repos.d]# yum search fuse

Loaded plugins: langpacks, presto, refresh-packagekit

Adding en_US to language list

Fuse

Output

Page 18: Open Source Manual Final

RESULT:

Thus the package was installed and it is verified.Ex.No:5 INSTALLING VARIOUS SOFTWARE PACKAGES

DATE:

AIM:

To install various software packages (cups) and also enable file sharing using

samba server in Linux.

PROCEDURE:

1. Cups is an application for printing

2. Check whether cups service is running using command " service cups status"

if the service is not running start the service using the command " service cups

start ".

3. Go to Internet Browser ( Firefox ) and type in the address bar "

http://localhost:631 "

Page 19: Open Source Manual Final

4. It displays the home page of cups.

5. " Under CUPS for Administrators " click " Adding Printers and Classes "

6. Under " Printers " click " Add Printer "

7. It will prompt for Username and Password , enter root and password.

8. It then lists out options for local Printers and Network Printers, select any one

of the option eg., select " LPT #1 " and click " continue " .

9. Then type Name , Description about printer and Location of the printer eg.,

LAB1 and click continue .

10. Here you have to select the Printer Make and click " ADD " then the model

name is selected and " Add Printer " is clicked

11. set default option for Printing Page is selected and "set default option" is

selected.

12. To add this printer as default printer goto System-> Administration -

>Printer->Right Click and set as default printer.

OUTPUT

Page 20: Open Source Manual Final
Page 21: Open Source Manual Final

SHARING LINUX DIRECTORY USING SAMBA SERVER

1. To check for the service type “ service smb status “ and if the service is not

running start the service by typing “ service smb start “.

2. To check for the package type “ rpm –qa | grep samba “

3. For sharing we need password hence password is set for the user to be

accessed by the sharing.

4. To add user type “ useradd winuser; passwd winuser “

5. To enable this user to access through samba account type “ smbpassword –a

winuser “

6. Type \\IPAddress of the linux system in the client machine and provide the

username and password created.

OUTPUT

IN LINUX

STARTING OF SMB AND NMB SERVICES

[root@localhost fuse-tutorial]# service smb status smb is stopped

[root@localhost fuse-tutorial]# service nmb status nmbd is stopped

[root@localhost fuse-tutorial]# service smb start Starting SMB services: [ OK ]

[root@localhost fuse-tutorial]# service nmb start Starting NMB services: [ OK ]

[root@localhost fuse-tutorial]#

CREATING USER AND ADDING TO SAMBA ACCOUNT

[ganesh@localhost fuse-tutorial]$ useradd test2 useradd: cannot lock

/etc/passwd; try again later. [ganesh@localhost fuse-tutorial]$ su Password:

[root@localhost fuse-tutorial]# useradd test2 [root@localhost fuse-tutorial]#

passwd test2 Changing password for user test2. New password: BAD

Page 22: Open Source Manual Final

PASSWORD: it is based on a dictionary word Retype new password: passwd:

all authentication tokens updated successfully. [root@localhost fuse-tutorial]#

smbpasswd -a test2 New SMB password: Retype new SMB password: Added

user test2. [root@localhost fuse-tutorial]#

IN WINDOWS

RESULT:

Page 23: Open Source Manual Final

Thus the data is shared between two operating system is done using samba

server and Common Unix Printing System is installed and verified

EX NO: 6 WRITE USERSPACE DRIVERS USING FUSE

DATE:

AIM:

To implement user space driver using fuse.

PROCEDURE:

1. Install fuse package.

2. After extracting using tar command , use ./compile and make , make install to

install the fuse package.

3. To check the fuse installation type “ modinfo fuse “ . It displays information

about fuse.

4. Mount the file system (bbfs) into a directory and check whether the file

system is loaded properly.

5. After checking the file system unmount the file system using the command

fusermount –u source directory mounted directory

6. Exit the terminal.

TO EXTRACT A PACKAGE

[ganesh@localhost Desktop]$ tar zxvf fuse-tutorial.tgz

fuse-tutorial/

fuse-tutorial/callbacks.html

fuse-tutorial/files.html

fuse-tutorial/index.html

fuse-tutorial/init.html

fuse-tutorial/private.html

fuse-tutorial/running.html

Page 24: Open Source Manual Final

fuse-tutorial/security.html

fuse-tutorial/thanks.html

fuse-tutorial/unclear.html

fuse-tutorial/example/

fuse-tutorial/example/mountdir/

fuse-tutorial/example/rootdir/

fuse-tutorial/example/rootdir/bogus.txt

fuse-tutorial/src/

fuse-tutorial/src/Makefile

fuse-tutorial/src/bbfs.c

fuse-tutorial/src/log.c

fuse-tutorial/src/log.h

fuse-tutorial/src/params.h

TO CHECK FOR THE MODULE INSTALLATION

[ganesh@localhost Desktop]$ modinfo fuse

filename: /lib/modules/2.6.35.6-45.fc14.i686/kernel/fs/fuse/fuse.ko

alias: devname:fuse

alias: char-major-10-229

license: GPL

description: Filesystem in Userspace

author: Miklos Szeredi <[email protected]>

srcversion: 5655074B2781008EDB812DA

depends:

vermagic: 2.6.35.6-45.fc14.i686 SMP mod_unload 686

parm: max_user_bgreq:Global limit for the maximum number of backgrounded

requests an unprivileged user can set (uint)

parm: max_user_congthresh:Global limit for the maximum congestion

threshold an unprivileged user can set (uint)

TO CHECK FOR THE PACKAGES RELATED TO FUSE

Page 25: Open Source Manual Final

[ganesh@localhost Desktop]$ rpm -qa | grep fuse

fuse-libs-2.8.5-5.fc14.i686

fuse-convmvfs-0.2.6-1.fc14.1.i686

gvfs-fuse-1.6.4-2.fc14.i686

fuse-devel-2.8.5-5.fc14.i686

fuse-2.8.5-5.fc14.i686

[ganesh@localhost Desktop]$ cd fuse-tutorial

[ganesh@localhost fuse-tutorial]$ cd src

[ganesh@localhost src]$ ls

bbfs.c log.c log.h Makefile params.h

[ganesh@localhost src]$ cd ..

TO COMPILE

[ganesh@localhost fuse-tutorial]$ pkg-config fuse --cflags

-D_FILE_OFFSET_BITS=64 -I/usr/include/fuse

[ganesh@localhost fuse-tutorial]$ pkg-config fuse --libs

-pthread -L/lib -lfuse -lrt -ldl

[ganesh@localhost fuse-tutorial]$ cd src

[ganesh@localhost src]$ make

gcc -g -Wall `pkg-config fuse --cflags` -c bbfs.c

gcc -g -Wall `pkg-config fuse --cflags` -c log.c

gcc -g `pkg-config fuse --libs` -o bbfs bbfs.o log.o

[ganesh@localhost src]$ cd ..

[ganesh@localhost fuse-tutorial]$ cd example/

[ganesh@localhost example]$ ls

mountdir rootdir

[ganesh@localhost example]$

CHECK FOR THE CONTENTS IN THE FOLDERS BEFORE

MOUNTING

[ganesh@localhost example]$ ls rootdir/

Page 26: Open Source Manual Final

bogus.txt

[ganesh@localhost example]$ ls mountdir/

[ganesh@localhost example]$

TO MOUNT THE FIE SYSTEM

[ganesh@localhost example]$ ../src/bbfs rootdir/ mountdir/

about to call fuse_main

[ganesh@localhost example]$

CHECK FOR THE CONTENTS IN THE FOLDERS AFTER MOUNTING

(BOTH THE DIRECTORIES HAVING SAME CONTENTS )

[ganesh@localhost example]$ ls mountdir/

bogus.txt

[ganesh@localhost example]$ ls rootdir/

bogus.txt

[ganesh@localhost example]$

[ganesh@localhost example]$ cd rootdir/

[ganesh@localhost rootdir]$ touch test.txt

[ganesh@localhost rootdir]$ ls

bogus.txt test.txt

[ganesh@localhost rootdir]$ cd ..

[ganesh@localhost example]$ ls mountdir/

bogus.txt test.txt

[ganesh@localhost example]$

TO UNMOUNT THE DIRECTORY USING FUSERMOUNT COMMAND

[ganesh@localhost example]$ fusermount -u mountdir/

[ganesh@localhost example]$

CHECK FOR THE CONTENTS IN THE FOLDERS AFTER UNMOUNTING (

BOTH THE DIRECTORIES HAVING DIFFERENT CONTENTS )

[ganesh@localhost example]$ ls mountdir/

[ganesh@localhost example]$ ls rootdir/

Page 27: Open Source Manual Final

bogus.txt test.txt

[ganesh@localhost example]$

TO MOUNT THE FIE SYSTEM IN A DIFFERENT DIRECTORY

[ganesh@localhost example]$ ../src/bbfs rootdir/ /home/ganesh/Desktop/g

g/ gnome-terminal.desktop

[ganesh@localhost example]$ ../src/bbfs rootdir/ /home/ganesh/Desktop/g

g/ gnome-terminal.desktop

[ganesh@localhost example]$ ../src/bbfs rootdir/ /home/ganesh/Desktop/g/

about to call fuse_main

[ganesh@localhost example]$ ls rootdir/

bogus.txt test.txt

[ganesh@localhost example]$ ls /home/ganesh/Desktop/g/

bogus.txt test.txt

[ganesh@localhost example]$

OUTPUT:

Page 28: Open Source Manual Final

RESULT: Thus the user space driver using fuse was implemented and verified.

EX NO: 7: GUI PROGRAMMING: A SAMPLE PROGRAM

DATE :

AIM:

To develop a simple program using Qt designer

PROCEDURE:

1. Install the QT package.

2. Start the QT designer using the command “ designer-qt4 “ in the terminal window.

3. A dialog box appears; choose New Main Window from the option available.

4. From the left side of the window we can select the needed widget for our form design.

5. After selecting the form design widget make the connection between each widget using the shortcut key “ F4 “

6. After making the connection make necessary changes in the property window at the right corner of the main window.

7. This property windows appears similar to Visual Basic interface.

8. Finally run the project using the shortcut key “ ctrl + r “

9. Or we can run using preview option under the menu “ Form - > Preview “

10. Close the window after verifying the output.

OUTPUT

Page 29: Open Source Manual Final
Page 30: Open Source Manual Final
Page 31: Open Source Manual Final
Page 32: Open Source Manual Final

RESULT Thus the program using QT designer was successfully executed and verified.

EX NO: 8 VERSION CONTROL SYSTEM SETUP AND USAGE DATE : USING RCS, CVS, SVN

AIM:

To create a version control system to monitor the repository of the application

installed.

DESCRIPTION & PROCEDURE:

CollabNet Subversion Edge - Linux 32/64-bit

Version 2.0.0

Release Date: June 14, 2011

Contents

1. Overview

Page 33: Open Source Manual Final

2. Platform and configuration

3. Requirements

4. Installation notes

5. Updates

6. Documentation

7. Known issues

8. Support for CollabNet Subversion Edge

9. About Subversion and CollabNet

1. Platform and configuration

Product: CollabNet Subversion Edge

License: GNU Affero General Public License 3.0 (AGPLv3)

Certified platforms: Red Hat Enterprise Linux 5.x

CentOS 5.x

SuSE Linux Enterprise 11.x

2. Requirements

* Java 1.6 JRE/JDK must be installed. We recommend the JRE provided by

Sun/Oracle. When testing on 64-bit Linux we have used the 64-bit JVM.

* Python 2.4 to 2.6 must be installed.

3. Installation Notes

1. Set the JAVA_HOME environment variable, and point it to your Java 6 JRE

home. For example:

export JAVA_HOME=/usr/java/default

Test the variable:

$ $JAVA_HOME/bin/java -version

java version "1.6.0_20"

Java(TM) SE Runtime Environment (build 1.6.0_20-b02)

Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

2. Switch to the folder where you want to install CollabNet Subversion

Page 34: Open Source Manual Final

Edge. You must have write permissions to this folder.

$ cd /opt

3. Untar the file you downloaded from CollabNet.

$ tar zxf CollabNetSubversionEdge-x.y.z_linux-x86.tar.gz

This will create a folder named "csvn" in the current directory. You can

rename this folder if desired.

4. Install the application so that it will start automatically

when the server restarts. This command generally requires root/sudo to execute.

$ cd csvn

$ sudo -E bin/csvn install

5. Configure proxy settings. CollabNet Subversion Edge need access to the

internet to check for and install updates. If you need to go through a proxy to

access the internet, then you can configure the proxy by editing the

data/conf/csvn.conf file which was created by the previous step. Uncomment

and edit the HTTP_PROXY variable to configure your proxy server.

6. Start the server. Be sure that you are logged in as your own userid and not

running as root.

$ bin/csvn start

This will take a few minutes and the script will loop until it sees that the server

is running. If the server does not start, then try starting the server with this

command:

$ bin/csvn console

This will start the server but output the initial startup messages to the console.

The default administrator login is:

Address: http://localhost:3343/csvn

Username: admin

Password: admin

Page 35: Open Source Manual Final

Subversion Edge also starts an SSL-protected version using a self-signed SSL

certificate. You can access the SSL version on this URL:

Address: https://localhost:4434/csvn

OUTPUT

Page 36: Open Source Manual Final
Page 37: Open Source Manual Final

RESULT:

Thus the version control software was implemented and verified.

Page 38: Open Source Manual Final

EX:NO: 9 TEXT PROCESSING WITH PERL

DATE:

Aim:

To write a Perl programs for text processing and implement Perl programs

with MySQL database connectivity.

PERL PROGRAMSProgram 1:

[fosslab@fosslab nm]$ vi peal.pl

#usr/bin/perl

#Define a string to replace

$mystring=”Hello, PERL!”;

print “Before Replacement :$mystring\n”;

substr($mystring,6)=”WORLD!”;

print “After Replacement:$mystring\n”;

Output:

[fosslab@fosslab ~]$ perl peal.pl

before replacement:Hello,PERL!

After Replacemant:Hello,WORLD!

Program 2:

[fosslab@fosslab nm]$ vi perl1.pl

#/usr/bin/perl

#Define an array

@coins=(“Quarter”,”Dine”,”Nickel”);

print “First statement:@coins”;

print “\n”;

#Add one element at the end of array

push(@coins,”penny”);

print “Second statement : @coins”;

print “\n”;

Page 39: Open Source Manual Final

#Add one element at the beginning of the array

unshift (@coins,”Dollar”);

print “Third statement:@coins”;

print “\n”;

#Remove one element from the last of the array

pop(@coins);

print “Fourth statement:@coins”;

print “\n”;

#Remove one element from the beginning of the array

shift(@coins);

print “Fifth statement:@coins”;

print “@coins”;

Output:

[fosslab@fosslab ~]$ perl perl1.pl

First statement:Quarter Dine Nickel

Second statement : Quarter Dine Nickel penny

third statement :Doller Quarter Dine Nickel

fourth statement:Doller Quarter Dine Nickel

Fifth statement :Quarter Dime Nickel

Program 3:

[fosslab@fosslab nm]$ vi one.pl

#/usr/bin/perl

print"Hello sample perl program";

print"Thats counts to Ten\n\n";

for(my$i=1;$i<10;$i++)

{ print"$i\n";

}

print"\n Thanks for running me\n";

Page 40: Open Source Manual Final

Output:

[fosslab@fosslab nm]$ perl one.pl

Hello sample perl programThats counts to Ten

1 2 3 4 5 6 7 8 9Thanks for running me

PERL with MySQL CONNECTIVITY PROGRAMS

Steps to be followed in MySQL

Go to terminal and perform the following:

[fosslab@fosslab ~]$ su -

Password: (fedora)

1. To enter service mysqld start

2. Mysql

[root@fosslab ~]# mysql

Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 5.1.51 Source distribution Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. To display the available databases:

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| TESTDB |

| college |

| employee |

Page 41: Open Source Manual Final

| mysql |

| sample |

| steel |

+--------------------+

7 rows in set (0.00 sec)

To create the new Database :

mysql> create database Student;

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| TESTDB |

| college |

| employee |

| mysql |

| sample |

| steel |

| student |

+--------------------+

8 rows in set (0.00 sec)

To use the student Database

mysql> use student;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> show tables;

+-------------------+

| Tables_in_student |

Page 42: Open Source Manual Final

+-------------------+

| EMPLOYEE |

| courses |

| courses1 |

| veni |

| veni1 |

+-------------------+

e. rows in set (0.00sec)

To create table details in the student Database

mysql> create table details (regno int, name varchar(20),age int);

mysql> descdetails;

regno | name | age

int varchar(20) int

Program 6.

Create the table in Perl that will be automatically updated in Database using

mysql

Program

# !usr/bin/perl

use DBI;

my $dbh=DBI->connect(“dbi:mysql:stud”,”root”,””);

If(!$dbh)

{

die(“error:$!”);

}

$sth=$dbh->prepare(“Create table student(rollno int,sname varchar(20))”);

$sth->execute();

Page 43: Open Source Manual Final

$dbh->disconnect;

Output:

Run the Perl script

[root@fosslab ~]# perl connect.pl

Go to MYSQL

now see the tables in database (“student”)

mysql> show tables;

+-------------------+

| Tables_in_student |

+-------------------+

| student |

+-------------------+

1 row in set (0.00 sec)

Program 5

Insert the values in Perl that will be automatically updated in database using

mysql as follows

#!usr/bin/perl

use DBI; #to use the build in package we use "Use", DBI is the build in

package in perl

my $dbh=DBI->connect("dbi:mysql:student","root",""); #connect to

database

if(!$dbh)

{

die("error:$!");

}

Page 44: Open Source Manual Final

$sth=$dbh->prepare("insert into students values(100,'sachin')"); # create

the table

$sth->execute();

$dbh->disconnect;

Compile the perl:

[root@fosslab ~]# perl dbinsert.pl

Output:

Go to MYSQL

mysql> select * from students;

+--------+----------+

| rollno | sname |

+--------+----------+

| 100 | Sachin |

+--------+----------+

1 row in set (0.00 sec)

RESULT:

Thus the program for perl using mysql connectivity is successfully

executed and verified.

Page 45: Open Source Manual Final

EX:NO: 10 PHP & MYSQL CONNECTIVITY

DATE:

Aim:

To create a login form and test the connectivity with MYSQL

Steps to execute php prgrams :

1. Open the vi editor and write the program

2. Save it using .php extension

3. Execute using the command php filename.php

4.Save progeam in /var/www/html

5.Open Terminal window Enter: su

Password:( fedora)

6. Service httpd start

7. Open the browser and type the URL as : http://localhost/formname.html

PHP PROGRAMS

1) Write a PHP program using simple HTML form

Program:formm.html

<html>

<head>

<title>LOGIN</title></head>

<body>

<form action="connect.php" method="post">

<p>"Enter course no"<input type="text" name="cid"></p>

<p>"enter the coursename"<input type="text" name="cname"></p>

<p>"click here to submit"<input type="submit" name="submit"></p>

</form>

</body>

Page 46: Open Source Manual Final

Connect.php:

<?php

$cid=$_POST['cid'];

$cname=$_POST['cname'];

$con=@mysql_connect("localhost","root","")or die (mysql-error());

echo "connected to database";

$db=@mysql_select_db("student",$con)or die(mysql_error());

echo "selected database";

$str="insert into courses1 values($cid,'$cname')";

$res=@mysql_query($str) or die(mysql_error());

if($res>0)

{

echo "Record created";

} Output:

OPEN THE BROWSER AND TYPE THE FOLLOWING PATH

http://localhost/formm.html

Page 47: Open Source Manual Final

RESULT:

Thus the program for php program is executed and verified successfully.

Page 48: Open Source Manual Final

2) Write a php program to Create login form

Create Login Page (HomePage.html):

<table width="300" border="0" align="center" cellpadding="0"

cellspacing="1" bgcolor="#CCCCCC">

<tr>

<form name="form1" method="post" action="checklogin.php">

<td>

<table width="100%" border="0" cellpadding="3" cellspacing="1"

bgcolor="#FFFFFF">

<tr>

<td colspan="3"><strong>Member Login </strong></td>

</tr>

<tr>

<td width="78">Username</td>

<td width="6">:</td>

<td width="294"><input name="myusername" type="text"

id="myusername"></td>

</tr>

<tr>

<td>Password</td>

<td>:</td>

<td><input name="mypassword" type="text" id="mypassword"></td>

</tr>

<tr>

<td>&nbsp;</td>

<td>&nbsp;</td>

<td><input type="submit" name="Submit" value="Login"></td>

</tr>

</table>

Page 49: Open Source Manual Final

</td>

</form>

</tr>

</table>

Create Validation Page (checklogin.php):

<?php

$host="localhost"; // Host name

$username="root"; // Mysql default username

//$password=""; // Mysql No password

$db_name="student"; // Database name

$tbl_name="members"; // Table name

// Connect to server and select databse.

mysql_connect("$host", "$username")or die("cannot connect");

mysql_select_db("$db_name")or die("cannot select DB");

// username and password sent from form

$myusername=$_POST['myusername'];

$mypassword=$_POST['mypassword'];

$sql="SELECT * FROM $tbl_name WHERE

username='$myusername' and password='$mypassword'";

$result=mysql_query($sql);

// Mysql_num_row is counting table row

$count=mysql_num_rows($result);

// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1)

echo "Welcome To Our Web Page";

else

echo "Wrong Username or Password";

?>

Page 50: Open Source Manual Final

Output:

TYPE THE FOLLOWING IN THE BROWSER

http://localhost/HomePage.html

RESULT

Page 51: Open Source Manual Final

Thus the program for php using MySQL database is executed and verified

successfully

EX: NO: 11 PYTHON & MYSQL CONNECTIVITY

DATE:

EX:NO:11 a)

Aim:

To Write a Python program to create a table in MYSQL using database

connectivity

Steps to execute python programs:

1. Open the Gedit editor and write the program

2. Save the program with .py as extension

3. Execute the program using python filename.py

Program

#!/usr/bin/python

import MySQLdb

# Open database connection

db = MySQLdb.connect("localhost","root","","student" )

# prepare a cursor object using cursor() method

cursor = db.cursor()

# Drop table if it already exist using execute() method.

cursor.execute("DROP TABLE IF EXISTS college ")

# Create table as per requirement

sql = """CREATE TABLE college ( FIRST_NAME CHAR(20) NOT

NULL,LAST_NAME

CHAR(20), AGE INT, SEX CHAR(1))"""

cursor.execute(sql)

# disconnect from server

db.close()

Page 52: Open Source Manual Final

Output:

Go to terminal:

[fosslab@fosslab ~]$ python Dbpython.py

[fosslab@fosslab ~]$ su -

Password: ******

Service mysqld start

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 26

Server version: 5.1.51 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

This software comes with ABSOLUTELY NO WARRANTY. This is free

software, and you are welcome to modify and redistribute it under the GPL v2

license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

Database

|

+--------------------+

| information_schema |

| TESTDB

| college

| employee

| mysql |

| sample |

| steel

| student

Page 53: Open Source Manual Final

| test

|+--------------------+

9 rows in set (0.00 sec)

mysql> use student;

mysql> show tables;

+-------------------+

| Tables_in_student |

+-------------------+

| EMPLOYEE

|

| courses |

| student |

+-------------------+

3 rows in set (0.00 sec)

mysql>> desc college;

+------------+----------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+------------+----------+------+-----+---------+-------+

| FIRST_NAME | char(20) | NO | | NULL | |

| LAST_NAME | char(20) | YES | | NULL | |

| AGE | int(11) | YES | | NULL | |

| SEX | char(5) | YES | | NULL | |

+------------+----------+------+-----+---------+-------+

4 rows in set (0.05 sec)

Result

Thus the python program was executed and table was created in MYSQL.

Page 54: Open Source Manual Final

EX: NO: 11b)

Aim:

To Write a Python program to create a table in MYSQL using database

connectivity

Steps to execute python programs:

1. Open the Gedit editor and write the program

2. Save the program with .py as extension

3. Execute the program using python filename.py

Program

#!/usr/bin/python

import MySQLdb

# Open database connection

db = MySQLdb.connect("localhost","root","","student" )

# prepare a cursor object using cursor() methods

cursor = db.cursor()

# Prepare SQL query to INSERT a record into the database.

sql = """INSERT INTO college(FIRST_NAME,LAST_NAME, AGE, SEX)

VALUES ('Sachin', 'Tendulkar', 35, 'M')"""

try:

# Execute the SQL command

cursor.execute(sql)

# Commit your changes in the database

db.commit()

except:

# Rollback in case there is any error

db.rollback()

# disconnect from server

Page 55: Open Source Manual Final

db.close()

Output:

Go to terminal:

[fosslab@fosslab ~]$ python Dbinser.py

[fosslab@fosslab ~]$ su -

Password: ******

Service mysqld start

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 26

Server version: 5.1.51 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

This software comes with ABSOLUTELY NO WARRANTY. This is free

software, and you are welcome to modify and redistribute it under the GPL v2

license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

Database

|

+--------------------+

| information_schema |

| TESTDB

| college

| employee

| mysql |

| sample |

| steel

| student

| test

Page 56: Open Source Manual Final

+--------------------+

9 rows in set (0.00 sec)

mysql> use student;

mysql> select * from college;

+------------+-----------+------+------+--------+

| FIRST_NAME | LAST_NAME | AGE | SEX | INCOME |

+------------+-----------+------+------+--------+

| Sachin | Tendulkar | 35 | M |

Result

Page 57: Open Source Manual Final

Thus the python program was executed and record was inserted into

MYSQL database.

EX:NO:11c)

Aim:

To Write a Python program to retrive data from a table using database

connectivity

Steps to execute python programs:

1. Open the Gedit editor and write the program

2. Save the program with .py as extension

3. Execute the program using python filename.py

Program

#!/usr/bin/python

# import the MySQLdb and sys modules

import MySQLdb

import sys

# open a database connection

db = MySQLdb.connect("localhost","root","","student" )

# prepare a cursor object using cursor() method

cursor = db.cursor ()

# execute the SQL query using execute() method.

cursor.execute ("select FIRST_NAME,FIRST_NAME,AGE,SEX,INCOME from

student")

# fetch all of the rows from the query

data = cursor.fetchall ()

# print the rows

for row in data :

print row[0], row[1],row[2],row[3],row[4]

# close the cursor object

cursor.close ()

# close the connection

db.close ()

Page 58: Open Source Manual Final

# exit the program

sys.exit()

Output:

Go to terminal:

[fosslab@fosslab ~]$ python Dbser.py

Sachin Tendulkar 30 M 20000

Dhoni MS 25 M 25000

Ajith Kumar 40 M 30000

Result

Page 59: Open Source Manual Final

Thus the python program was executed and record was retrived using

MYSQL database

EX NO: 12 SETTING UP THE ENTIRE NETWORK

DATE:

AIM:

To establish and set the entire network in terminal window using commands

PROCEDURE:

IPADDRESS

1. To see the ip configuration " ifconfig "

2. To check network status " service network status "

3. To set an Ip for an Ethernet connection and uplink or enable an Ethernet

connection type in terminal

" ifconfig eht0 172.16.100.40 network 255.255.0.0 up "

4. To check for gateway " route -n "

5. To assign gateway " route add default gw 172.16.100.254 "

6. To remove default gateway " route del default "

DNS

7. You have to be super user to access DNS to be a super user type " su "

in the terminal and enter root password

8. To map to an ip goto terminal and type " vi /etc/resolv.conf "

delete all the lines and type the following

nameserver 172.16.100.254 and save the file using the command

Esc+Shift+:wq

9. check for the active state of an ip using the command in terminal window

" ping 172.16.100.254 " or " ping cse.velmultimedia.com "

10. To make the configuration type " vi /etc/sysconfig/network-scripts/ifcfg-

eth0

DEVICE=eth0

NM_CONTROLLED=yes

Page 60: Open Source Manual Final

HWADDR="40:61:86:BD:B6:DC"

ONBOOT=yes

BOOTPROTO="dhcp"

IPUCINIT=no

TYPE=Ethernet " and save it

11. Then restart the network service by typing " service network restart "

12. to check the gateway type " route -n "

13. To assign gateway type the following

" vi /etc/sysconfig/network "

and type the following

NETWORKING=yes

HOSTNAME=localhost.localdomain

GATEWAY=172.16.100.254

and save the file.

14. To make it as static include the following

IPADDR=172.16.100.254

NETMASK=255.255.0.0

BOOTPRO=static

in /etc/sysconfig/network-scripts/ifcfg-eht0 and save it and restart the

network

15. " service network restart " and " service networkmanager restart "

FIREWALL

16. To block a website typ the following in terminal window

" iptables -A INPUT -s 212.240.12.16 -j REJECT "

17. To clear all firewall rules " iptables -F"

18. To lista out all iptable option " iptables -L "

19. To save the iptables " iptables -save "

20. To see the network configuration details type " ip a "

Page 61: Open Source Manual Final

OUTPUT

[root@localhost Desktop]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:0C:29:C5:6C:64

inet addr:172.16.100.40 Bcast:172.16.255.255 Mask:255.255.0.0

inet6 addr: fe80::20c:29ff:fec5:6c64/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:1293 errors:0 dropped:0 overruns:0 frame:0

TX packets:1350 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:138816 (135.5 KiB) TX bytes:151335 (147.7 KiB)

Interrupt:19 Base address:0x2000

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:363 errors:0 dropped:0 overruns:0 frame:0

TX packets:363 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:117089 (114.3 KiB) TX bytes:117089 (114.3 KiB)

virbr0 Link encap:Ethernet HWaddr FA:E9:85:B2:13:8B

inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:133 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0 (0.0 b) TX bytes:20052 (19.5 KiB)

[root@localhost Desktop]# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

Page 62: Open Source Manual Final

192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0

172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0

[root@localhost Desktop]# route add default gw 172.16.100.254

[root@localhost Desktop]# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0

172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0

0.0.0.0 172.16.100.254 0.0.0.0 UG 0 0 0 eth0

[root@localhost Desktop]# route del default

[root@localhost Desktop]# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0

172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0

[root@localhost Desktop]# vi /etc/resolv.conf

[root@localhost Desktop]#

[root@localhost Desktop]# service networkmanager restart

networkmanager: unrecognized service

[root@localhost Desktop]# service network restart

Shutting down interface eth0: Device state: 3 (disconnected) [ OK ]

Shutting down loopback interface: [ OK ]

Bringing up loopback interface: [ OK ]

Bringing up interface eth0: Active connection state: activating

Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/4

state: activated

Connection activated [ OK ]

Bringing up interface eth1: Active connection state: activating

Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/5

state: activated

RESULT:

Page 63: Open Source Manual Final

Thus the setting up of the network interface was completely successfully and it is

verified.