gkm 2013.pdf

Upload: pandees-velu

Post on 14-Apr-2018

263 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 GKM 2013.pdf

    1/58

    http:/

    /cse

    tube

    .tk/

    GKM COLLEGE OF ENGINEERING AND TECHNOLOGY

    Alapakkam Mappedu Road, GKM Nagar,Chennai.

    DEPARTMENT OF COMPUTER SCIENCE ENGINEERING

    CS2406 - OPEN SOURCE LABORATORY MANUAL

    VII SEMESTER

    20122013

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    2/58

    http:/

    /cse

    tube

    .tk/

    EX NO : 1A STORING DATA INTO DATABASE

    PROBLEM STATEMENT:

    To write a php program for storing the data in the database.

    PROBLEM DESCRIPTION:

    PROCEDURES:

    1. Open the application -> system tools -> terminals [$prompt will be opened]2. Type the command su and admin123 as username and password.3. Create the html file using the command #cat> fm.html and #cat > connect1.php.4. Save both files in the part cd/var/www/html.5. Goto the terminal and type #mysqlu root6. Now create the database using the command create database databasename.7. To view database use the command show database8.

    Use connect.9. Type the command use database name.

    10.Createthe table using SQL command create table tablename.11.Save the program.12.To runthe program open the opera explorer in the address bar type the

    http://localhost/fm.html13.To view the table use the command select * from the tablename.

    PROGRAM:

    Dataform.html:

    LOGIN

    Enter customer no

    Enter the customer name

    click here to submit

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    3/58

    http:/

    /cse

    tube

    .tk/

    Database.php:

  • 7/27/2019 GKM 2013.pdf

    4/58

    http:/

    /cse

    tube

    .tk/

    mysql> select * from cdetail;+------+---------+| cno | cname |+------+---------+| 1 | qq || 2 | parveen|

    +------+---------+2 rows in set (0.00 sec)

    mysql> exitBye

    RESULT:

    Thus the above PHPprogram for storing datas into Database is executed successfully and theoutput is verified.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    5/58

    http:/

    /cse

    tube

    .tk/

    EX NO : 1B VALIDATING THE DATABASE IN THE DATABASE

    USING PHP

    PROBLEM STATEMENT:

    To write the php program for validating the data in the database.

    PROBLEM DESCRIPTION:

    PROCEDURES:

    1. Open the application -> system tools -> terminals [$prompt will be opened]2. Type the command su and admin123 as username and password.3. Create the html file using the command #cat> valid.html and #cat > date.php.4. Save both files in the part cd/var/www/html.5. Goto the terminal and type #mysqlu root6. Now create the database using the command create database databasename.7. To view database use the command show database8. Use connect.9. Type the command use database name.10.Createthe table using SQL command create table tablename.11.Save the program.12.To runthe program open the opera explorer in the address bar type the

    http://localhost/valid.html13.To view the table use the command select * from the tablename.

    LOGIN.HTML

    Member LoginUsername:Password:

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    6/58

    http:/

    /cse

    tube

    .tk/

    VALIDATE.PHP

  • 7/27/2019 GKM 2013.pdf

    7/58

    http:/

    /cse

    tube

    .tk/

    RESULT:Thus the above php program was executed successfully and the output is verified.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    8/58

    http:/

    /cse

    tube

    .tk/

    EXNO: 2A PROGRAMMING WITH PERL

    PROBLEM STATEMENT:

    To implement a fedora Linux using Perl program in FOSSLAB server.

    PROBLEM DESCRIPTION:

    1.open application -> Systemtools ->Terminal.

    2.type the username:su and password :admin123.

    3.Type the program and save it with the extension of .pl.

    4.press ctrl+Dand get logout to the root,then compile the program by typing (ex:perlfilename.py).

    5.If any error happen log on to the program and debug it.

    6.If no error happens verify the output.

    7.close the terminal window.

    1. STRING OPERATION

    # ! Usr/bin/perl$a=karuna;$b=mani;

    Print$ a. $b,\n;$str=-;Print $str*80,\n;@a=(10,25);Print@a\n;

    OUTPUT:

    [root@fosslab DMFOSS]#Perl stringoper.plKaruna Mani010 25

    2.FIND MAXIMUM VALUE USING FUNCTION

    # ! Usr/bin/perlSub max(){$max=shift@_;Foreach$v(@_)

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    9/58

    http:/

    /cse

    tube

    .tk/

    {$max=$v if $max$b)&&($a>$c)){PrintA is greater;}

    elseif (($b>$c)&&($b>$a)){PrintB is greater;}else{PrintC is greater;}

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    10/58

    http:/

    /cse

    tube

    .tk/

    OUTPUT:[root@fosslab DMFOSS]#Perl great3.plEnter A value:4Enter B value:5Enter C value:9C is greater

    5.PROGRAM WHICH OPENS AN EXISTING FILE file1.txt AND READ IT LINE BY

    LINE AND GENERATE ANOTHER COPY FILE file2.txt

    # ! Usr/bin/perlOpen(DATA1,m.txt);While(){Print DATA2$_;}Close(DATA1);Close(DATA2);unlink(/var/www/html/DMFOSS/r.txt);

    OUTPUT:

    [root@fosslabDMFOSS]#vi d.txtKaruna[root@fosslabDMFOSS]#vi m.txt[root@fosslabDMFOSS]#vi r.txt

    [root@fosslabDMFOSS]#Perl genfile.pl[root@fosslabDMFOSS]#vi m.txtkaruna

    6.PROGRAM FOR COPYING,MOVING AND DELETE FUNCTION

    # ! Usr/bin/perlUse File:: CopyPrint\nCopying the content present from file1 o file2;$filetobecopied=d1.txt;

    $newfile=m1.txt;Copy($filetobecopied,$newfile)or die(file cant be copied);Print\nMove function;$oldlocation=/var/www/html/DMFOSS/r1.txt;$newlocation=/var/www/html/DMFOSS/DM/r1.txt;Move($oldlocation,$newlocation);Print/nDelete function;$file=/var/www/html/DMFOSS/r2.txt;

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    11/58

    http:/

    /cse

    tube

    .tk/

    if(unlink($file)==0){Print\n File deleted successfully;}else{Print\nFile was not deleted;}

    OUTPUT:

    [root@fosslab DMFOSS]#vi cmdfn.pl[root@fosslab DMFOSS]#vi d1.txtKaruna Mani[root@fosslab DMFOSS]#vi m1.txt[root@fosslab DMFOSS]#vi r1.txt[root@fosslabDMFOSS]#vi r2.txt[root@fosslabDMFOSS]#mkdir DM[root@fosslabDMFOSS]#perl cmdfn.plCopying the content present from file1 to file2Move functionDelete functionFile deleted successfully.

    RESULT:Thus the simple programs are executed in PERL and the output is verified successfully.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    12/58

    http:/

    /cse

    tube

    .tk/

    EX NO : 2B PROGRAMMING ON PERL WITH DATABASE

    PROBLEM STATEMENT:

    To write a program on perl to create table in database and insert some values.

    PROBLEM DESCRIPTION:

    PROCEDURES:

    1. Open the application -> system tools -> terminals.2. Include the packages by using the command rpm q perl .DBJ and rpm q perl .DBA-

    mySQL.

    3. Type the command su and admin123 as username and password respectively.4. Type the command mysql u root to enter into data base and create databasestudent

    to create the database.

    5. Use connect to connect with database which shows connection id and current database.6. Createfile connect.pl with database student and create table name students with field

    roll noas integer and sname as character.

    7.

    To seethe output enter into mysql and type the command use student andshow tables.8. Createfile dbinsert.pl which connects with the database student and insert a value intotable.

    9. Createfile dbinsert.pl which connects with the database student and insert a value intothe table using execute command.

    CREATING DATABASE:

    [root@fosslabDMFOSS]# mysql -u root

    mysql> createdatabase student12;

    Query OK, 1 row affected (0.02 sec)

    mysql> use student12;Database changed

    mysql> connect;

    Connection id: 3

    Current database: student12

    mysql> show tables;

    Empty set (0.00 sec)

    INCLUDING PACKAGES:

    [fosslab@fosslab ~]$ rpm -q perl-DBI

    perl-DBI-1.613-1.fc14.i686

    [fosslab@fosslab ~]$ rpm -q perl-DBD-MySQL

    perl-DBD-MySQL-4.017-1.fc14.i686

    CONNECT.PL

    #!usr/bin/perl

    use DBI;

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    13/58

    http:/

    /cse

    tube

    .tk/

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

    if(!$dbh)

    {

    die("error:$!");

    }

    $sth=$dbh->prepare("create table students(rollno int,sname varchar(50))");

    $sth->execute();

    $dbh->disconnect;

    OUTPUT:

    [root@fosslab DMFOSS]# vi connect.pl

    [root@fosslab DMFOSS]# perl connect.pl

    [root@fosslabDMFOSS]# mysql -u root

    mysql> use student12;Database changed

    mysql> show tables;

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

    | Tables_in_student12 |

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

    | students |

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

    1 row in set (0.00 sec)

    DBINSERT.PL#!usr/bin/perl

    use DBI;

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

    if(!$dbh)

    {

    die("error:$!");

    }

    $sth=$dbh->prepare("insert into students values(5,'palani')");

    $sth->execute();

    $dbh->disconnect;

    OUTPUT:

    [root@fosslab DMFOSS]# vi dbinsert.pl

    [root@fosslab DMFOSS]# perl dbinsert.pl

    [root@fosslab DMFOSS]# mysql -u root

    mysql> use student12;

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    14/58

    http:/

    /cse

    tube

    .tk/

    Database changed

    mysql> select * from students;

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

    | rollno | sname |

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

    | 5 | prem |

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

    1 row in set (0.00 sec)

    DBINSERT1.PL

    #!usr/bin/perl

    use DBI;

    $rollno=4;

    $sname="natraj";

    my $dbh=DBI->connect("dbi:mysql:student12","root","");if(!$dbh)

    {

    die("error:$!");

    }

    $sth=$dbh->prepare("insert into students values(?,?)");

    $sth->execute($rollno,$sname);

    $dbh->disconnect;

    OUTPUT:

    [root@fosslabDMFOSS]# vi dbinsert1.pl[root@fosslabDMFOSS]# perl dbinsert1.pl

    [root@fosslabDMFOSS]# mysql -u root

    mysql> use student12;

    Database changed

    mysql> select * from students;

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

    | rollno | sname |

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

    | 5 | prem |

    | 4 | natraj |

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

    2 rows in set (0.00 sec)

    RESULT:

    Thus the perl program to create database and to insert some values was executed and the output

    is verified.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    15/58

    http:/

    /cse

    tube

    .tk/

    EXNO: 3 PROGRAMING ON PYTHON

    PROBLEM STATEMENT:

    To implement a program in python using fedora(linux) in FOSS Lab server.

    PROBLEM DESCRIPTION:

    1.open application -> Systemtools ->Terminal.

    2.type the username:su and password :admin123.

    3.Type the program and save it with the extension of .py.

    4.press ctrl+D and get logout to the administrator,then compile the program by typing(ex:python filename.py).

    5.If any error happen log on to the program and debug it.

    6.If no error happens verify the output.

    7.close the terminal window.

    STRING CONCATENATION IN PYTHON:

    worda='DEEPA';wordb='MANI';print("worda is ",worda);print("wordb is",wordb);

    wordc=worda+" " +wordb;print("wordc is",wordc);wordd=worda*3;print("wordd is ",wordd);str = 'DEEPAMANI.M'length=len(str);print ("str :",str);print("length:",length);print ("first character is",str[0]);print ("print character from 2rd to 6th :", str[2:7] );print ("Prints string starting from 3rd character:",str[2:]);

    print ("Prints string two times",str * 2);print ("Prints concatenated string :",str + "RAJA" );print(str[-1]);print(str[-6]);print(str[:-2]);

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    16/58

    http:/

    /cse

    tube

    .tk/

    OUTPUT:

    [root@fosslab fosslab]# python strconcat.py('worda is ', 'DEEPA')('wordb is', 'MANI')('wordc is', 'DEEPA MANI')('wordd is ', 'DEEPADEEPADEEPA')('str :', 'DEEPAMANI.M')('length:', 11)('first character is', 'D')('print character from 2rd to 6th :', 'EPAMA')('Prints string starting from 3rd character:', 'EPAMANI.M')('Prints string two times', 'DEEPAMANI.MDEEPAMANI.M')('Prints concatenated string :', 'DEEPAMANI.MRAJA')MMDEEPAMANI

    PYTHON LISTS:

    #Python Lists#!/usr/bin/pythonprint("\t \t \t Python Lists");list = [ 'deepa', 786 , 2.23, 'mani', 70.2 ]tinylist = [123, 'mani']print("Prints complete list:",list);print("Prints first element of the list : ",list[0]);print("Prints elements starting from 2nd to 4th:",list[1:3]);print("Prints elements starting from 3rd element:",list[2:]);

    print("Prints list two times:",tinylist * 2);print("Prints concatenated lists: ", list + tinylist );print("Before modifying the 4th element in list :",list[4]);list[4]='RAJA';print("4th element in list :",list[4]);print(" complete list:",list);list.append('raja');print("After appending list:",list);del list[2];print("List :",list);

    OUTPUT:

    [root@fosslab fosslab]# python list.pyPython Lists

    ('Prints complete list:', ['deepa', 786, 2.23, 'mani', 70.2])('Prints first element of the list : ', 'deepa')('Prints elements starting from 2nd to 4th:', [786, 2.23])('Prints elements starting from 3rd element:', [2.23, 'mani', 70.2])

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    17/58

    http:/

    /cse

    tube

    .tk/

    ('Prints list two times:', [123, 'mani', 123, 'mani'])('Prints concatenated lists: ', ['deepa', 786, 2.23, 'mani', 70.2, 123, 'mani'])('Before modifying the 4th element in list :', 70.2)('4th element in list :', 'RAJA')(' complete list:', ['deepa', 786, 2.23, 'mani', 'RAJA'])('After appending list:', ['deepa', 786, 2.23, 'mani', 'RAJA', 'raja'])('List :', ['deepa', 786, 'mani', 'RAJA', 'raja'])

    PYTHON TUPLES:

    #Python Tuplesprint("\t \t \t Python tuples");tuple = ( 'deepa', 786 , 2.23, 'mani', 70.2 )tinytuple = (123, 'mani')print("\ncomplete tuple :",tuple);print("Prints first element of the tuple:", tuple[0]);print("Prints elements starting from 1nd to 3th:", tuple[1:4]);print("Prints elements starting from 3rd element:", tuple[2:]);print("Prints tuple two times:", tinytuple * 2 );print ("concatenated tuple:",tuple + tinytuple );

    OUTPUT:

    [root@fosslabfosslab]# python tuple.pyPython tuples

    ('\ncomplete tuple :', ('deepa', 786, 2.23, 'mani', 70.2))('Prints first element of the tuple:', 'deepa')('Prints elements starting from 1nd to 3th:', (786, 2.23, 'mani'))('Prints elements starting from 3rd element:', (2.23, 'mani', 70.2))

    ('Prints tuple two times:', (123, 'mani', 123, 'mani'))('concatenatedtuple:', ('deepa', 786, 2.23, 'mani', 70.2, 123, 'mani'))

    PYTHON DICTIONARY:

    #Python Dictionarytinydict = {'name': 'raja','code':1311, 'dept': 'sales'}print ("Python Dictionary:" );print ("complete dictionary",tinydict );print ("Key :",tinydict.keys());print ("values:",tinydict.values());

    OUTPUT:

    [root@fosslab fosslab]# python dict.pyPython Dictionary:('complete dictionary', {'dept': 'sales', 'code': 1311, 'name': 'raja'})('Key :', ['dept', 'code', 'name'])('values:', ['sales', 1311, 'raja'])

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    18/58

    http:/

    /cse

    tube

    .tk/

    SET OPERATION IN PYTHON

    [fosslab@fosslab ~]$ pythonPython 2.7 (r27:82500, Sep 16 2010, 18:03:06)[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2Type "help", "copyright", "credits" or "license" for more information.[fosslab@fosslab ~]$ vi setoper.py>>> basket=['apple','orange','pear','orange','banana']>>> fruit=set(basket)>>> fruitset(['orange', 'pear', 'apple', 'banana'])>>> 'orange' in fruitTrue>>> 'crabgrass' in fruitFalse>>> a=set('abracadabra')>>> b=set('alacazam')>>> aset(['a', 'r', 'b', 'c', 'd'])>>> a-bset(['r', 'b', 'd'])>>> a&bset(['a', 'c'])>>> a^bset(['b', 'd', 'm', 'l', 'r', 'z'])>>>

    RESULT:

    Thus the programs are done in python and is executed successfully.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    19/58

    http:/

    /cse

    tube

    .tk/

    EXNO: 4 KERNEL CONFIGURATION, COMPILATION & INSTALLATION

    PROBLEM STATEMENT:

    To learn how to configure, compile and install Linux kernel from source.

    PROBLEM DESCRIPTION:

    The Linux kernel in the distributions is configured to work correctly in a wide variety

    of hardware and there is usually no need to use any other kernel.

    A user may want to rebuild the kernel for various reasons. The main reason was once to

    optimize the kernel to the environment (hardware and usage patterns). With modern hardware

    there is rarely a need to recompile unless there is a particular feature of a new kernel that is

    required. Theperformance gains are probably not noticeable unless specific benchmarks are

    being run.

    PROCEDURE:

    Download and kernel source(linux-2.6.39.2.tar.bz2) package from the internet> yum install kernel-devel

    This command will ensure that all packages required to compile thecurrentrunning kernel will be installed. We will be using the same tools to compilethe newercustomkernel.

    Remove traces of old kernel source if they exist# rmrf /usr/src/linux/

    # rm -rf /usr/src/linux-2.6/

    The kernel source is usually kept under /usr/src. Copy the downloaded kernel source to/usr/src.

    # cp linux-2.6.39.2.tar.bz2 /usr/src

    # cd /usr/src/

    # tar -xjvf linux-2.6.39.2.tar.bz2

    # cd linux-2.6.39.2

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    20/58

    http:/

    /cse

    tube

    .tk/

    create two symlinks to the kernel tree.# ln -s /usr/src/linux-2.6.39.2 /usr/src/linux# ln -s /usr/src/linux-2.6.39.2 /usr/src/linux-2.6

    Clean out all previous configurations and reset the source directory to a pristine state. Themain reason for doing this is that some files do not automatically get rebuilt, which can

    lead to failed builds, or at worst, a buggy kernel

    # make mrproper

    Now configure the Kernel# make xconfig

    (or)# make menuconfig

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    21/58

    http:/

    /cse

    tube

    .tk/

    Save and exit the tool Use the command to build the kernel

    # make clean

    # make all

    The compilation can take up anywhere from 10 minutes to upto 2 hours depending on the

    hardware.

    Install the kernel and its modules.# make modules_install# make install

    The newly created kernel will be in /boot Now check whether the new kernel is properly configured in the boot loader

    # vi /boot/grub/menu.lst

    Change the lines containing default, timeout to the values shown and commentout the hiddenmenu entry.

    default=0

    timeout=5

    #hiddenmenu

    Now reboot the computer and the computer will boot into new kernel To check the version of the running kernel, use the uname command.

    # unamer2.6.39.2

    RESULT:

    Thus configuration, compilation and installation of Linux kernel from source is done

    successfully.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    22/58

    http:/

    /cse

    tube

    .tk/

    EXNO:5 VIRTUALIZATIONENVIRONMENT

    PROBLEM STATEMENT:To learn the Virtualization using virtualBox software and installing MS-DOS in

    virtual machine

    PROBLEM DESCRIPTION:

    In computing, virtualization (or virtualisation) is the creation of a virtual (rather thanactual) version of something, such as a hardware platform, operating system (OS), storagedevice, or network resources.

    Oracle VM VirtualBox (formerly Sun VirtualBox, Sun xVM VirtualBox and innotekVirtualBox) is an x86 virtualization software package, created by software company InnotekGmbH, purchased in 2008 by Sun Microsystems, and now developed by Oracle Corporation aspart of its family of virtualization products. Oracle VM VirtualBox is installed on an existinghost operating system as an application; this host application allows additional guest operating

    systems, each known as a Guest OS, to be loaded and run, each with its own virtualenvironment.

    Procedure:

    Download the Oracle VirtualBox software from the internet Install the software using the following command.

    #rpmivh VirtualBox-4.2-4.2.0_80737_el6-1.x86_64.rpm

    Open the VirtualBox manager.

    # virtualbox

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    23/58

    http:/

    /cse

    tube

    .tk/

    Click the New button and enter a name for the OS and select the os from the list

    In the next screen, select the ram size for the virtual machine

    In the next screen, select create new hard drive for creating a virtual hard disk

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    24/58

    http:/

    /cse

    tube

    .tk/

    In the next screen choose the type of file that you would like to use for the new virtualHard disk. Select VDI(virtualBox Disk Image) file type

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    25/58

    http:/

    /cse

    tube

    .tk/

    In the next screen, select Dynamically allocated as the storage detail

    In the next screen, choose the hard disk location and file size

    In the next screen, view the summary of the virtual hard disk and click create buttonhttp://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    26/58

    http:/

    /cse

    tube

    .tk/

    Now select the os and click start button on the toolbar In the next screen, select the OS image file from the host computer by clicking

    the icon .

    In the next screen, select boot from cd-rom to boot the ISO image.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    27/58

    http:/

    /cse

    tube

    .tk/

    Select continue with free dos installation

    Now the virtual OS is installed using VirtualBox software.

    RESULT:

    Thus Virtualization is learnt by installing MS-DOS in virtual machine like virtual box.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    28/58

    http:/

    /cse

    tube

    .tk/

    EXNO : 6 COMPILING SOFTWARE FROM SOURCE

    PROBLEM STATEMENT:

    To learn about the common build systems available in Linux and to use them.

    PROBLEM DESCRIPTION:

    Open source software is distributed in source code form. In case of popular software

    Linux distributions will often have the software packaged in their repositories. If the package

    is not package is not in the repository the user has to compile the software from source. To do

    this the user has to understand about the build system used in the project.

    The GNU build system, also known as the Auto tools, is a suite of programming

    tools designed to assist in making source-code packages portable to many Unix-like systems.

    It can be difficult to make a software program portable: the C compiler differs from system to

    system; certain library functions are missing on some systems; header files may have differentnames. One way to handle this is write conditional code, with code blocks selected by means

    of preprocessor directives (#ifdef); but because of the wide variety of build environments this

    approach quickly becomes unmanageable. The GNU build system is designed toaddress this

    problem more manageably.

    PROCEDURE:

    1. Make

    Createa new directory> mkdir gnumake

    > cd gnumake

    Create a new file in the qthello directory.> gedit squareroot.c

    // squareroot.c// A simple program that computes the square root of a number

    #include

    #include

    #include

    int main (int argc, char *argv[])

    {

    if (argc < 2)

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    29/58

    http:/

    /cse

    tube

    .tk/

    {

    fprintf(stdout,"Usage: %s number\n",argv[0]);

    return 1;

    }

    double inputValue = atof(argv[1]);

    double outputValue = sqrt(inputValue);

    fprintf(stdout,"The square root of %g is %g\n",inputValue,outputValue);

    return 0;

    }

    Test the program by compiling it once:> gcc squareroot.c -o squareroot -lm

    > ./sqaureroot 49

    > The square root of 49 is 7

    Create a makefile to compile the program>gedit Makefile

    # Commands start with TAB not spaces

    CC = gccCFLAGS = -gLDFLAGS = -lmall: squarerootsquareroot: squareroot.osquareroot.o: squareroot.cclean:rm -f squareroot squareroot.o

    Test the Makefile

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    30/58

    http:/

    /cse

    tube

    .tk/

    > makemake: Nothing to be done for `all'.> make cleanrm -f squareroot squareroot.o> makegcc -g -c -o squareroot.o squareroot.c gcc -lm squareroot.o -o squareroot> ./squareroot 49The square root of 49 is 7

    2.Apache Ant

    Apache ant uses java. So we need to install java> yum install java-1.6.0-openjdk-devel> yum install ant

    Create a new directory> cd ../../> mkdir ant> cd ant> mkdir -p src/hello> gedit src/hello/HelloWorld.java

    The Code:

    package hello;public class HelloWorld{public static void main(String[] args)

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    31/58

    http:/

    /cse

    tube

    .tk/

    {System.out.println("Hello World");}}

    Compile the program> mkdir -p build/classes

    > javac -sourcepath src -d build/classes/ src/hello/HelloWorld.java

    > java -cp build/classes hello.HelloWorld

    Hello World

    Createa Ant build script> gedit build.xml

    The Code:

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    32/58

    http:/

    /cse

    tube

    .tk/

    Now compile and run the program>ant clean

    >ant compile jar run

    RESULT:

    Thus the common build systems available in Linux is learnt to use and build successfully.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    33/58

    http:/

    /cse

    tube

    .tk/

    EXNO: 7A COMMON UNIX PRINTING SYSTEM (CUPS)

    PROBLEM STATEMENT:

    To know the how to install the package Common Unix Printing System

    (CUPS) and add a printer

    PROBLEM DESCRIPTION:

    Printing within UNIX has historically been done using one of two printing systems -

    the Berkeley Line Printer Daemon ("LPD") [RFC1179] and the AT&T Line Printer system.

    These printing systems were designed in the 70's for printing text to line printers; vendors

    have since added varying levels of support for other types of printers.

    PROCEDURE:

    Download and install the cups package from the internet#yum install cups

    Open the cups in any browser by the following URLhttp://localhost:631/

    Click on the Adding Printers and Classes

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://localhost:631/
  • 7/27/2019 GKM 2013.pdf

    34/58

    http:/

    /cse

    tube

    .tk/

    Then click on the Add Printer

    After clicking on the Add Printer It will ask you for permission. Here you have to enterthe system root username and password

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    35/58

    http:/

    /cse

    tube

    .tk/

    If your printer is connected to the network it shows in the Discovered Network Printers.Select the printer and click on Continuebutton.

    In this window give the name of printer, description and also location.

    Here select the manufacturer of the Printer and click on continue button.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    36/58

    http:/

    /cse

    tube

    .tk/

    Then select the Model of the Printer and click on the add printer.

    Click on set default option to manage paper size and also colour and qualityhttp://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    37/58

    http:/

    /cse

    tube

    .tk/

    Now the printer is added successfully

    See whether the printer is properly configured. Go to System->Administration->Printing

    RESULT:

    To know the how to install the package Common Unix Printing System

    (CUPS) and adding a printer is done successfully.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    38/58

    http:/

    /cse

    tube

    .tk/

    EXNO: 7B SAMBA INSTALLATION AND CONFIGURATION

    PROBLEM STATEMENT:

    To know the how to install the package Samba and configure it to share files to windows

    PROBLEM DESCRIPTION:

    Samba can be used with Linux to provide transparent access between machines running

    Linux and machines running Windows. Samba itself runs on a Linux machine and makes shared

    files and printers available to Windows machines, as if they are available on a Window machine

    or server. Thus, Samba has several practical applications which can generally be categorized as

    follows:

    PROCEDURE:

    Download and install the samba package from the internet#yum install samba

    Checkthe status of the samba service#service smb status#service nmb status

    Start the samba service if it is stopped#service smb start

    #service nmb start

    Create a new user#useradd grs

    Set the password for the create user#passwd grs#New password:#Retype new password:

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    39/58

    http:/

    /cse

    tube

    .tk/

    Add the user to access samba shares with a password#smbpasswda grs#New SMB password:#Retype new SMB password:

    Now to access the shared files from windows, open the samba location as followingStart->runEnter the ip address of the linux machineEg:\\172.16.15.85

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://smb//172.16.15.85/http://smb//172.16.15.85/http://smb//172.16.15.85/http://csetube.weebly.com/http://csetube.weebly.com/http://smb//172.16.15.85/
  • 7/27/2019 GKM 2013.pdf

    40/58

    http:/

    /cse

    tube

    .tk/

    It displays login window to log into the samba user. Here username and password shouldbe what you given to while creating samba username and smb password.

    Eg: username: sriramPassword: sri123

    Now the shared files are displayed.

    RESULT:

    Thus installation of Samba package and configuring it to share files to windows is donesuccessfully.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    41/58

    http:/

    /cse

    tube

    .tk/

    EXNO: 8 WRITING USERSPACE DRIVERS USING FUSE

    PROBLEM STATEMENT:

    To understand the concepts behind Filesystems in Userspace and to write a simple userspace

    driver.

    PROBLEM DESCRIPTION:

    A file system (filesystem) is means to organize data expected to be retained after

    a program terminates by providing procedures to store, retrieve and update data, as well as

    manage the available space on the device(s) which contain it. A file system organizes data in

    an efficient manner and is tuned to the specific characteristics of the device. There is usually a

    tight coupling between the operating system and the file system. Some filesystems provide

    mechanisms to control access to the data and metadata. Insuring reliability is a major

    responsibilityof a filesystem. Some filesystems provide a means for multiple programs to

    update data in the same file nearly at the same time.

    Filesystem in Userspace (FUSE) is a loadable kernel module for Unix-like computer

    operating systems that lets non-privileged users create their own file systems without editing

    kernel code. This is achieved by running file system code in user space while the FUSE

    module provides only a "bridge" to the actual kernel interfaces.

    PROCEDURE:

    Download and install the fuse package and its development files from the internet>yum install fuse-devel

    Createa new directory> mkdir fuseprog

    > cd fuseprog

    Create a new file in the fuseprog directory>gedit hello.c

    //hello.c#define FUSE_USE_VERSION 26#include #include #include #include #include

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    42/58

    http:/

    /cse

    tube

    .tk/

    #include static const char *hello_str = "Hello World!\n";static const char *hello_path = "/hello";static int hello_getattr(const char *path, struct stat *stbuf){int res = 0;memset(stbuf, 0, sizeof(struct stat));if(strcmp(path, "/") == 0) {stbuf->st_mode = S_IFDIR | 0755;stbuf->st_nlink = 2;}else if(strcmp(path, hello_path) == 0) { stbuf->st_mode = S_IFREG | 0444; stbuf->st_nlink = 1;stbuf->st_size = strlen(hello_str);}elseres = -ENOENT;return res;}static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler,{(void) offset;(void) fi;off_t offset, struct fuse_file_info *fi)if(strcmp(path, "/") != 0)return -ENOENT;filler(buf, ".", NULL, 0);filler(buf, "..", NULL, 0);filler(buf, hello_path + 1, NULL, 0);

    return 0;}static int hello_open(const char *path, struct fuse_file_info *fi){if(strcmp(path, hello_path) != 0)return -ENOENT;if((fi->flags & 3) != O_RDONLY)return -EACCES;return 0;}static int hello_read(const char *path, char *buf, size_t size, off_t offset,

    {(void) fi;size_t len;struct fuse_file_info *fi)if(strcmp(path, hello_path) != 0)return -ENOENT;len = strlen(hello_str);if (offset < len) {

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    43/58

    http:/

    /cse

    tube

    .tk/

    if (offset + size > len)size = len - offset;memcpy(buf, hello_str + offset, size);} elsesize = 0;return size;}tatic struct fuse_operations hello_oper = {.getattr = hello_getattr,.readdir = hello_readdir,.open = hello_open,.read = hello_read,};int main(int argc, char *argv[]){return fuse_main(argc, argv, &hello_oper, NULL);}

    Compile the program with gcc> gcc -Wall `pkg-config fuse --cflags --libs` hello.c -o hello

    Run the program as a root user> su

    # mkdir tmp

    # ./hello tmp/

    After running the program,a single file is generated in the tmp/ folder named hello and itscontent should be Hello World.

    # ./hello tmp/

    # ls tmp/

    hello

    # cat tmp/hello

    Hello World!

    Unmount the filesystem# unmount tmp/

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    44/58

    http:/

    /cse

    tube

    .tk/

    RESULT:

    Thus the concepts behind File systems in User space are understood and a simple user space

    driver is written.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    45/58

    http:/

    /cse

    tube

    .tk/

    EXNO: 9 GUI PROGRAMMING

    PROBLEM STATEMENT:

    To write GUI programs using GUI toolkits in Linux

    PROBLEM DESCRIPTION:

    GUI programming on Linux is based on the X Window system. X provides windowing

    on computer displays and manages keyboard, pointing device control functions and touch-

    screens. X provides the basic framework, or primitives, for building such GUI environments:

    drawing and moving windows on the display and interacting with a mouse, keyboard or

    touchscreen.

    There are two popular GUI toolkits which are widely used today. They are Qt and

    GTK+. Qt is written in C++ while GTK+ is written in C. Both toolkits provide bindings in a

    wide variety of languages.

    PROCEDURE:

    Download and install the QT package and its development files from the internet> yum install qt-devel qt-demos qt-examples qt-doc

    Createa new directory> mkdir qthello

    > cd qthello

    Createa new file in the qthello directory.

    > gedit qthello.cpp

    //qthello.cpp#include

    #include

    #include

    int main(int argc,char *argv[])

    {

    QApplication app(argc,argv);

    QWidget window;window.resize(320, 240);

    window.setWindowTitle("Hello World!");

    QPushButton *button=new QPushButton("Press me",&window);

    button->move(100,100);

    button->show();

    window.show();

    return app.exec();

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    46/58

    http:/

    /cse

    tube

    .tk/

    }

    Compile and run the program with qmake> qmake-qt4project> qmake-qt4

    > make> ./qthello

    RESULT:

    Thus GUI Programs are written by using LINUX GUI toolkits successfully.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    47/58

    http:/

    /cse

    tube

    .tk/

    EXNO: 10 VERSION CONTROL SYSTEM SETUP AND USAGE

    PROBLEM STATEMENT:

    To setup a version control system for managing files using svn. The system should beable to track changes to the files/folders and a period of time and revert if necessary

    PROBLEM DESCRIPTION:

    Version control is the concept of managing all changes to a repository. The repositorycould be containing any type of file. In computer software engineering, revision control is anypractice that tracks and provides control over changes to source code. Software developerssometimes use revision control software to maintain documentation and configuration filesas well as source code.

    Revision control may also track changes to configuration files, such as those typicallystored in /etc or

    /usr/local/etc on Unix systems. This gives system administrators another way to easily trackchanges madeand a way to roll back to earlier versions should the need arise.

    PROCEDURE:

    Download and install the svn package from the internet#yum install mod_dav_svn subversion

    Createnecessary folder for the repository#setenforce 0#mkdir /svn#mkdir /svn/repos#cd /svn/repos#chown -R apache.apache ../repos

    Initialize the svn structure and create a repository#svnadmin create svn-test

    Create a local folder structure# mkdir /home//svn-test# cd /home//svn-test

    Create local directories# mkdir configurations options main

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    48/58

    http:/

    /cse

    tube

    .tk/

    Create an new file#vim configurations/test.cfg>hello world

    Import the initial structure onto the svn# svn import /home//svn-test/ file:///svn/repos/svn-test/ -m "Initial Import"

    Give permission for the newly committed repo to be accessible by apache# chown -R apache.apache /svn/repos/

    Edit subversion.conf at /etc/httpd/conf.d/subversion.conf for configuring theapache# gedit /etc/httpd/conf.d/subversion.conf

    DAV svnSVNParentPath /svn/reposAuthType BasicAuthName "Subversion repos"AuthUserFile /etc/svn-auth-confRequire valid-user

    Restart the http service#service httpd restart

    Configure password for authentication#htpasswd -cm /etc/svn-auth-conf

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    49/58

    http:/

    /cse

    tube

    .tk/

    Checkout the repo#cd /tmp/# svn --username= co http://localhost:80/repos/svn-test/

    Edit the file test.cfg and make any changes and save them

    # cd /tmp/svn-test/# lsconfigurations main options# vim configurations/test.cfg

    >hello world>hai

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    50/58

    http:/

    /cse

    tube

    .tk/

    Commit the changes made to the file# svn commit -m "Added a line to testconf1.cfg."Sending configurations/test.cfgTransmitting file data .Committed revision 2.

    Adding and deleting some items# lsconfigurations main options# cd configurations/# cp /etc/yum.conf .# svn add yum.confA yum.conf# svn commit -m "Added yum conf"Adding configurations/yum.confTransmitting file data .Committed revision 3.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    51/58

    http:/

    /cse

    tube

    .tk/

    List out all the revisions# svn log http://localhost:80/repos/svn-test/

    RESULT:

    Thus a Version control system is setup using SVN successfully.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    52/58

    http:/

    /cse

    tube

    .tk/

    EXNO: 11 SETTING UP OF COMPLETE NETWORK INTERFACE

    PROBLEM STATEMENT:To set up Network Interface using 'ifconfig' command and the related system

    files.

    PROBLEM DESCRIPTION:

    A Network interface is the point of interconnection between a computer and a privateor public network. A network interface is generally a network interface card (NIC).

    Gateway is a node that allows you to gain entrance into a network and vice versa.On the Internet the node which is the stopping point can be a gateway or a host node. Acomputer that controls the traffic your network or your ISP (Internet Service Provider) receivesis a node.

    DNS (Domain name server), the system that automatically translates Internet

    addresses to the numeric machine addresses that computers use.

    Iptables is a user space application program provided by the Linux kernel firewall(implemented as different Netfilter modules) ,that allows us to configure the tables and thechains and rules it stores.

    Procedure:

    1. Configuring the network

    Assignan IP address for the computer# ifconfig eth0 192.168.x.y netmask 255.255.255.0 up

    Adding a hub to the machine# route addnet 192.168.0.0 netmask 255.255.255.0 eth0

    To contact hosts outside the network if a machine with IP address 192.168.x.y isthe gateway

    # route add default gw 192.168.x.y eth0

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://en.wikipedia.org/wiki/Netfilterhttp://en.wikipedia.org/wiki/Linux_kernelhttp://en.wikipedia.org/wiki/User_space
  • 7/27/2019 GKM 2013.pdf

    53/58

    http:/

    /cse

    tube

    .tk/

    2. Configuring an interface for multiple IP addresses

    To usemultiple IP address on one Ethernet card copy the file named ifcfg-eth0 located in/etc/sysconfig/network-scripts directory

    DEVICE="eth0"IPADDR="192.168.2.100" NETMASK="255.255.0.0"ONBOOT="yes"BOOTPROTO="none"

    Createa new file named ifcfg-eth0:0 in the same directory and paste the content.

    Modify the file as the following

    DEVICE="eth0:0"IPADDR="192.168.2.101"NETMASK="255.255.0.0"ONBOOT="yes"BOOTPROTO="none"

    To add more IP address replace :0 with :1, :2, :3 Now restart the system to make it effective

    #service network restart

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    54/58

    http:/

    /cse

    tube

    .tk/

    3. Configuring the DNS

    Edit the network file present in the /etc/sysconfig/ directoryNETWORKING=yesFORWARD_IPV4=falseHOSTNAME=yourname.collegename.comDOMAINNAME=collegename.comGATEWAY=192.168.x.yGATEWAYDEV=eth0

    WhereGATEWAYDEV is the network interface card that is attached to the network.The GATEWAY is the actual IP address of the gateway machine

    .

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    55/58

    http:/

    /cse

    tube

    .tk/

    4. Managing IPTABLES

    Start,stop and restart the iptables using the following commands:#service iptables start#service iptables stop#service iptables restart

    To make iptables configured to start on boot, use the following command:# chkconfig iptables on

    Check the status of the iptables#service iptables status

    RESULT:

    Thus setting up of Network Interface using 'ifconfig' command and the relatedsystem files is done successfully.

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    56/58

    http:/

    /cse

    tube

    .tk/

    EXNO:12 PACKAGE MANAGEMENT SYSTEM

    PROBLEM STATEMENT:To build,maintain and serve rpm package repository over http and to configure the clientmachines to access this repository.

    PROBLEM DESCRIPTION:In software, a package management system, also called package manager, is a

    collection of software tools to automate the process of installing, upgrading, configuring, andremoving software packages for a computer's operating system in a consistent manner. Ittypically maintains a database of software dependencies and version information to preventsoftware mismatches and missing prerequisites.

    Packages are distributions of software, applications and data. Packages also contain metadata,such as the software's name, description of its purpose, version number, vendor, checksum, anda list of dependencies necessary for the software to run properly. Upon installation, metadata isstored in a local package database.

    PROCEDURE:

    Createa new directory#mkdir -p /var/www/html/RPMS

    Copy few rpm files to /var/www/html/RPMS#cp file.rpm /var/www/html/RPMS/

    Install createrepo to generate the metadata of the software packages#yum install createrepo

    Create repo for the directory in which we have copied the RPMS#createrepo /var/www/html/RPMS

    Start the HTTP service to serve the content#service httpd start

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/
  • 7/27/2019 GKM 2013.pdf

    57/58

    http:/

    /cse

    tube

    .tk/

    Createa new file to configure YUM in client machine to work with our repository#vim /etc/yum.repos.d/test.repo

    Code:[repo]name=Fedora $releasever - $basearchfailovermethod=priority

    baseurl=http://10.0.2.15/RPMS/#give your server IP hereenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY

    Now Try to install any package using yum command#yum install cmake.rpm

    http://csetube.weebly.com/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://192.168.2.68/RPMS/http://192.168.2.68/RPMS/
  • 7/27/2019 GKM 2013.pdf

    58/58

    http:/

    /cse

    tube

    .tk/

    Open the browser and type the URL of the server machine and download the rpm filesfrom the client machine

    http://10.0.2.15/RPMS/

    http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://csetube.weebly.com/http://10.0.2.15/RPMS/http://10.0.2.15/RPMS/http://csetube.weebly.com/http://csetube.weebly.com/http://10.0.2.15/RPMS/