Monday, October 17, 2011

Brief History of Open Source Software


Free Software VS Proprietary Software

It could be said that in the beginning, there was only free (libre) software. Later on, proprietary software  was  born,  and  it  quickly  dominated  the  software  landscape,  to  the  point  that  it  is today considered as the only possible model by many people. Only recently has the software industry considered free software as an option again.

When IBM and others sold the first large-scale commercial computers, in the 1960s, they came with some software which was free , in the sense that it could be freely shared among users, it came with source code, and it could be improved and modified. In the late 1960s, the situation changed  after  the  "unbundling"  of  IBM  software,  and  in  mid-1970s  it  was  usual  to  find
proprietary  software,  in  the  sense that  users  were  not  allowed  to  redistribute  it,  that  source code was not available, and that users could not modify the programs. 

Inception of Open Source Software Movement

In late 1970s and early 1980s, two different groups were establishing the roots of the current
open source software movement:

• On  the  US  East  coast,  Richard  Stallman,  formerly  a  programmer  at  the  MIT  AI  Lab, resigned,  and  launched  the  GNU  Project  and  the  Free  Software  Foundation.  The ultimate  goal  of  the  GNU  Project  was  to  build  a  free  operating  system,  and  Richard started by coding some programming tools (a compiler, an editor, etc.). As a legal tool, the  GNU  General  Public  License  (GPL)  was  designed  not  only  to  ensure  that  the
software produced by GNU will remain free, but to promote the production of more and more  free  software.  On  the  philosophical  side,  Richard  Stallman  also  wrote  the  GNU Manifesto,  "stating  that  availability  of  source  code  and  freedom  to  redistribute  and modify software are fundamental rights.”

• On the US West coast, the Computer Science Research Group (CSRG) of the University of  California  at  Berkeley  was  improving  the  Unix  system,  and  building  lots  of applications  which  quickly  become  ”BSD  Unix''.  These  efforts  were  funded  mainly  by DARPA  contracts,  and  a  dense  network  of  Unix  hackers  around  the  world  helped  to debug,  maintain  and  improve  the  system.  During  many  time  that  software  was  not
redistributed outside the community of holders of a Unix AT&T licence. But in the late 1980s, it was finally distributed under the “BSD licence'', one of the first open source licences. Unfortunately, at that time every user of BSD Unix also needed an AT&T Unix licence,  since  some  parts  of  the  kernel  and  several  important  utilities,  which  were needed for a usable system, were still proprietary. Early 1990s During the 1980s and early 1990s, open source software continued its development, initially in several relatively isolated groups. USENET and the Internet helped to coordinate transnational
efforts,  and  to  build  up  strong  user  communities.  During  1991-1992,  the  whole  landscape  of open source software and of software development in general, was ready to change. Two very exciting events were taking place, although in different communities: 

• In California, Bill Jolitz was implementing the missing portions to complete the Net/2 distribution,  until  it  was  ready  to  run  on  i386-class  machines.  Bill  called  his  work 386BSD,  and  it  quickly  became  appreciated  within  the  BSD  and  Unix  communities.  It included not only a kernel, but also many utilities, making a complete operating system.

• In Finland, Linus Torvalds, a student of computer science, unhappy with Tanenbaum's Minix, was implementing the first versions of the Linux kernel. Soon, many people were collaborating to make that kernel more and more usable, and adding many utilities to complete   GNU/Linux,   a   real   operating   system.   The   Linux   kernel,   and   the   GNU applications used on top of it are covered by GPL. 

1990s – The Golden Period

In 1993, both GNU/Linux and 386BSD were reasonably stable platforms. Since then, 386BSD has evolved into a family of BSD based operating systems (NetBSD, FreeBSD, and OpenBSD), while the  Linux  kernel  is  healthy  evolving  and  being  used  in  many  GNU/Linux  distributions Slackware, Debian, Red Hat, Suse, Mandrake, and many more). 

During  the  1990s,  many  open  source  projects  have  produced  a  good  quantity  of  useful  (and usually high-quality) software. Some of them are Apache (widely used as a WWW server), Perl(an   interpreted   language   with   lots   of   libraries),   XFree86   (the   most   widely   used   X11
implementation for PC-based machines), GNOME and KDE (both providing a consistent set of libraries and applications to present the casual user with an easy to use and friendly desktop environment),  Mozilla  (the  free  software  project  funded  by  Netscape  to  build  a  WWW browser), etc. Of all these projects, GNOME and KDE are especially important, because they address usability by non-technical people.

The  late  1990s  are  very  exciting  times  with  respect  to  open  source  software.  Open  source systems based on GNU/Linux or *BSD are gaining public acceptance, and have become a real alternative  to  proprietary  systems,  competing  head  to  head  with  the  market  leaders  (like Windows NT in servers). In many niches, the best choice is already open source (an outstanding case is Apache as Web server, with a market share consistently over 50%). 

Intoduction to Open Source Software

OPEN SOURCE

Open  source  is  a  development  method  for  software  that  harnesses  the  power  of  distributed peer review and transparency of process. The promise of open source is better quality, higher reliability, more flexibility, lower cost, and an end to predatory vendor lock-in.

THE OPEN SOURCE DEFINITION

The definition of Open Source according to the OSI (Open Source Initiative) is as follows:

Open  source  doesn't  just  mean  access  to  the  source  code.  The  distribution  terms  of  open-source software must comply with the following criteria:

1. Free Redistribution

The license shall not restrict any party from selling or giving away the software as a component of an aggregate software distribution containing programs from several different sources. The license shall not require a royalty or other fee for such sale.

2. Source Code

The program must include source code, and must allow distribution in source code as well as compiled form. Where some form of a product is not distributed with source code, there must be  a  well-publicized  means  of  obtaining  the  source  code  for  no  more  than  a  reasonable reproduction  cost  preferably,  downloading  via  the  Internet  without  charge.  The  source  code must  be  the  preferred  form  in  which  a  programmer  would  modify  the  program.  Deliberately obfuscated   source   code   is   not   allowed.   Intermediate   forms   such   as   the   output   of   a preprocessor or translator are not allowed.

3. Derived Works

The license must allow modifications and derived works, and must allow them to be distributed under the same terms as the license of the original software.

4. Integrity of the Author's Source Code

The license may restrict source-code from being distributed in modified form only if the license allows the distribution of "patch files" with the source code for the purpose of modifying the program  at  build  time.  The  license  must  explicitly  permit  distribution  of  software  built  from modified  source  code.  The  license  may  require  derived  works  to  carry  a  different  name  or version number from the original software.

5. No Discrimination against Persons or Groups

The license must not discriminate against any person or group of persons.

6. No Discrimination against Fields of Endeavor

The  license  must  not  restrict  anyone  from  making  use  of  the  program  in  a  specific  field  of endeavor. For example, it may not restrict the program from being used in a business, or from being used for genetic research.

7. Distribution of License

The  rights  attached  to  the  program  must  apply  to  all  to  whom  the  program  is  redistributed without the need for execution of an additional license by those parties.

8. License Must Not Be Specific to a Product

The rights attached to the program must not depend on the program's being part of a particular software distribution. If the program is extracted from that distribution and used or distributed within  the  terms  of  the  program's  license,  all  parties  to  whom  the  program  is  redistributed should have the same rights as those that are granted in conjunction with the original software distribution.

9. License Must Not Restrict Other Software

The  license  must  not  place  restrictions  on  other  software  that  is  distributed  along  with  the licensed software. For example, the license must not insist that all other programs distributed on the same medium must be open-source software.

10. License Must Be Technology-Neutral

No provision of the license may be predicated on any individual technology or style of interface.

Saturday, October 1, 2011

Installing Samba and Sharing files with windows

AIM

To install SAMBA(Server Message Block) in the linux system and share the files to windows OS.

INTRODUCTION

Samba allows file and print sharing between computers running Windows and computers running Unix. It is an implementation of dozens of services and a dozen protocols. Samba sets up network shares for chosen Unix directories (including all contained subdirectories). These appear to Microsoft Windows users as normal Windows folders accessible via the network. Integrating Fedora Linux into a Windows network is reasonable and easy as long as we use the SAMBA utilities.

First, we must allow the Linux server full rights and access to the Windows workgroup and local domain. That means that either in our Active Server environment we need to reserve an IP address for the Linux server, or we simply need to ensure a hard coded IP address is given to the Linux server.   The server must have a reserved IP address whether we deliver it via DHCP or statically assign it in the DNS. This also means that we need to ALLOW SMB DAEMON to operate. We can ensure our system security does this by editing our Firewall setup or using system-config-securitylevel.

Second, we must ensure that SAMBA (SAMBA tools and the SMB protocol) is installed and running on the Linux server.   Most versions of Fedora come with the necessary packages. We should also be sure to update our SAMBA security levels properly if we are having trouble accessing a shared directory. This is found under Samba Server Configuration tool, main menu Properties, option Server Settings, and then the tab: Security.

Now we are ready to configure our Fedora Linux/SAMBA machine (SAMBA Server).

PROCEDURE

1.    SMB(Server Message Block) is a protocol used by Microsoft family of OS for file and print sharing.

2.    Open the window terminal in linux and check whether SAMBA package is installed or not.
$rpm –qa|grepsamba

It will display the SAMBA packages installed in linux machine.

3.    Switch to supervisor$su(root) mode give the password. 

4.    Now check whether SAMBA service is started or not. By default it is running,else we have to start SAMBA services.
#service smb status
It displays SAMBA is stopped.

#service smb start
It will start the SAMBA service.

5.    Similarly check for NMB.
#service nmb status
#service nmb start

6.    Stop the IP table services.
#service ip tables stop
Similarly stop the IP version 6 table.
#service ip6tables stop

7.    Type getenforce   (disabled)
Type setenforce 0 set enforce: SE Linux is disabled.

8.    Now add,smbusername and password.

To add username Type
#useradd winuser
To give password, Type
#smbpasswd –a winuser
New SMB password: admin
Retype new SMB password: admin
Added user winuser.

9.    After adding SAMBA user, we have to restart the SAMBA service.

10.    Access the SAMBA server from windows. You are now ready to use the SAMBA server for your work.

11.    On the windows PC, click start menu and choose host name of SAMBA server and give the IP address of SAMBA server.

12.    If it works well, you can see a server login windows give the SAMBA username and password created in the precious steps.

13.    Now you can access the shared folders in the windows machine.


(Sample Screenshots)


Installing Common Unix Printing System (CUPS)

AIM

To install the Common Unix Printing system into the local system.

INTRODUCTION

CUPS is the standards-based, open source printing system developed by Apple Inc. for Mac OS® X and other UNIX®-like operating systems. A computer running CUPS is a host that can accept print jobs from client computers, process them, and send them to the appropriate printer.

CUPS consists of a print spooler and scheduler, a filter system that converts the print data to a format that the printer will understand, and a backend system that sends this data to the print device. CUPS uses the Internet Printing Protocol (IPP) as the basis for managing print jobs and queues.

CUPS can be downloaded from the internet link http://www.cups.org/software.php

(In this post an example for adding HP printer is given) 

PROCEDURE

1.    Open the terminal window in linux and check whether the CUPS installed or not.
$rpm –qa|grep cups
to display the list of CUPS packages installed in your system.

2.    Check whether the CUPS services is enabled or not, we need root permission.
$su

3.    Give the password as admin123
#service cups status
4.    Goto browser and type
http://localhost:631/ displays the CUPS 1.4.4 HOMEPAGE

5.    Under CUPS for admin click adding printer and classes link.

6.    Under printer click and printer type username and password.
Username: root       password: your_password

7.    Select the local printer option button and select ‘Hp printer(HPLIP)’ and click continue.

8.    To display connection urls and click continue.
In connection type http://localhost:631/

9.    Now type name, description, location of the printer.
Eg: Hp1010           des:Hp1010laserjet printer                  location:lab1   and click contine.

10.    Next select Make from the list as ‘HP’. Click continue.

11.    Select model as list Hp1010  select Hplaserjet 1010,hpcups 3010.6(en) click add printer.

12.    Now it displays set default options of Hp1010 window.

13.    In the general listing you can change the print mode, media size etc. Click set default options.

14.    It displays printer Hp1010 default option have been set successfully, now click the Hp10101 link and maintenance is sample paper print. 


(Sample Screenshot)

Wednesday, September 21, 2011

Running PHP Programs

PHP + MySQL Program

Question - To create simple applications like login forms after setting up a LAMP Stack.

Here however we are designing a PHP application that obtains the information from a student and stores it in the MySQL database.

(This post assumes that you have created a LAMP Stack. If not Click Here to refer to my previous post) 


Steps Involved


1.       Go to the terminal and login as root.

2.       Move to the /var/www/html folder by entering the following command:
[root@fosslab fosslab]# cd /var/www/html

3.       Create a filenamed ‘phpdata.php’ using vi editor.

[root@fosslab html]# vi phpdata.php

Now inside enter the following code

phpdata.php

<html>

<head>

                <title>Student Registration!</title>

</head>

<body bgcolor="lightgreen">

<b><center>    <h2>Student Registration Form</h2>

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

                    <table cellpadding="10" cellspacing="10">          

                    <tr>

                    <td><label for="lbl_name">Name</td>

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

                    </tr>

                    <tr>

                    <td><label for="lbl_email">Email Id</td>

                    <td><input type="text" name="email"></td>

                    </tr>

                    <tr>

                    <td><label for="lbl_mobile">Mobile Number</td>

                    <td><input type="text" name="mobile"></td>

                    </tr>

                    <tr>

                    <td><label for="lbl_college">College</td>

                    <td><input type="text" name="college"></td>

                    </tr>

                    <tr>

                    <td><label for="lbl_degree">Degree</td>

                    <td><input type="text" name="degree"></td>

                    </tr>

                    <tr>

                    <td><label for="lbl_branch">Branch</td>

                    <td><input type="text" name="branch"></td>

                    </tr>

                    <tr>

                    <td><label for="lbl_year">Year</td>

                    <td><input type="text" name="year"></td>

                    </tr>

                    <tr>

                    </table>    

                    <input type="submit" value="Register" name="Submit">

                                    </form></center></b>                          

</body>

</html>

4.       Now save the file and create another one named ‘handle_register.php’.
[root@fosslab html]# vi handle_register.php

Now enter the following code:

handle_register.php


<?php

if($_POST['name']=="" || $_POST['email']=="" || $_POST['mobile']=="" || $_POST['college']=="" || $_POST['degree']=="" || $_POST['branch']=="" || $_POST['year']=="")

{

echo "<h3>Please go back and fill in all the details.</h1>";

die();

}

else

{

$name = $_POST['name'];

$email = $_POST['email'];

$mobile = $_POST['mobile'];

$college = $_POST['college'];

$degree = $_POST['degree'];

$branch = $_POST['branch'];

$year = $_POST['year'];

$connect = mysql_connect("localhost","root","admin123") or die( "Unable to select database");

mysql_select_db("register");

$query = "SELECT * from students where Email='$email'";

$results = mysql_query($query);

$query = "INSERT INTO students (Name,Email,Mobile,College,Degree,Branch,Year) VALUES ('$name','$email','$mobile','$college','$degree','$branch','$year')";

$results = mysql_query($query);

echo "<h2>Thank you " . $name . " for registering.</h2>";

echo "<br><br>List of Students Enrolled:<br><br>";

echo "<table border='2' cellpadding='3'><tr><td>Name</td><td>Email</td><td>Mobile</td><td>College</td><td>Degree</td><td>Branch</td><td>Year</td></tr>";

$query = "SELECT * from students";

$results = mysql_query($query);

while($info = mysql_fetch_array($results))

{

echo "<tr><td>".$info['Name']."</td><td>".$info['Email']."</td><td>".$info['Mobile']."</td><td>".$info['College']."</td><td>".$info['Degree']."</td><td>".$info['Branch']."</td><td>".$info['Year']."</td></tr>";

}

echo "</table>";

}

mysql_close();

?>

Now you have completed your coding part. Next step is to create database in MySQL. We use PhpMyAdmin for it.

Steps for creating database in PhpMyAdmin

1.       In your browser type http://localhost/phpmyadmin

2.       Click the Databases tab. In the Create New Databse textbox type register and click create. 

3.       Next in the create new table frame enter name as ‘students’ and number of fields as ‘7’. Click Go. Now fill in the following

Field
Type
Name
Text
Email
Text
Mobile
Text
College
Text
Degree
Text
Branch
Text
Year
Text
4.        
      Now finally click Save button below.
5.       Now that’s it!! You have created the database.

Executing the Program

1.       Go to the browser and type http://localhost/phpdata.php.

2.       Fill in the details (all details) and click Register.

3.       Now in the next page a Thank you message and list of entries in database will come indicating the success of the program.

Download the Source Code