This work (Netizen "Database Programming with Perl" training module notes) is licensed under theOpen Publication License.
LICENSE
Terms and Conditions for Copying, Distributing, and Modifying
Items other than copying, distributing, and modifying the Content with which this license wasdistributed (such as using, etc.) are outside the scope of this license.
1. You may copy and distribute exact replicas of the OpenContent (OC) as you receive it, in anymedium, provided that you conspicuously and appropriately publish on each copy an appropriatecopyright notice and disclaimer of warranty; keep intact all the notices that refer to this License andto the absence of any warranty; and give any other recipients of the OC a copy of this License alongwith the OC. You may at your option charge a fee for the media and/or handling involved in creatinga unique copy of the OC for use offline, you may at your option offer instructional support for the OCin exchange for a fee, or you may at your option offer warranty in exchange for a fee. You may notcharge a fee for the OC itself. You may not charge a fee for the sole service of providing access toand/or use of the OC via a network (e.g. the Internet), whether it be via the world wide web, FTP, orany other method.
2. You may modify your copy or copies of the OpenContent or any portion of it, thus forming worksbased on the Content, and distribute such modifications or work under the terms of Section 1above, provided that you also meet all of these conditions:
a) You must cause the modified content to carry prominent notices stating that you changed it, theexact nature and content of the changes, and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in part contains or isderived from the OC or any part thereof, to be licensed as a whole at no charge to all third partiesunder the terms of this License, unless otherwise permitted under applicable Fair Use law.
These requirements apply to the modified work as a whole. If identifiable sections of that work arenot derived from the OC, and can be reasonably considered independent and separate works inthemselves, then this License, and its terms, do not apply to those sections when you distributethem as separate works. But when you distribute the same sections as part of a whole which is awork based on the OC, the distribution of the whole must be on the terms of this License, whosepermissions for other licensees extend to the entire whole, and thus to each and every partregardless of who wrote it. Exceptions are made to this requirement to release modified worksfree of charge under this license only in compliance with Fair Use law where applicable.
3. You are not required to accept this License, since you have not signed it. However, nothing elsegrants you permission to copy, distribute or modify the OC. These actions are prohibited by law ifyou do not accept this License. Therefore, by distributing or translating the OC, or by deriving worksherefrom, you indicate your acceptance of this License to do so, and all its terms and conditionsfor copying, distributing or translating the OC.
NO WARRANTY
4. BECAUSE THE OPENCONTENT (OC) IS LICENSED FREE OF CHARGE, THERE IS NOWARRANTY FOR THE OC, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHENOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIESPROVIDE THE OC "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED ORIMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OFMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK OF USEOF THE OC IS WITH YOU. SHOULD THE OC PROVE FAULTY, INACCURATE, OR OTHERWISEUNACCEPTABLE YOU ASSUME THE COST OF ALL NECESSARY REPAIR OR CORRECTION.
5. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILLANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MIRROR AND/OR REDISTRIBUTETHE OC AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANYGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USEOR INABILITY TO USE THE OC, EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEENADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Additionally:
6. If you offer training based upon this OpenContent, you must prominently display a notice stating whether or notyou are a Netizen Certified Training Organisation on the Open Contentitself and on any material advertising or publicising your training.
a) If you are a Netizen Certified Training Organisation, you must statethat you are a Netizen Certified Training Organisation and display theNetizen Certified Training Organisation logo. You must also provide aURL for more information, namely http://netizen.com.au/services/training/ncto/
b) If you are not a Netizen Certified Training Organisation, you muststate that you are not a Netizen Certified Training Organisation. Youmay not use the Netizen Certified Training Organisation logo. Youmust also provide a URL for more information, namely http://netizen.com.au/services/training/ncto/
- Table of Contents
- 1. Introduction
- Course outline
- Assumed knowledge
- Module objectives
- Platform and version details
- The course notes
- Other materials
- 2. About databases
- In this chapter...
- What is a database?
- Types of databases
- Database management systems
- Uses of databases
- Chapter summary
- 3. Textfiles as databases
- In this chapter...
- Delimited text files
- Reading delimited text files
- Searching for records
- Sorting records
- Writing to delimited text files
- Comma-separated variable (CSV) files
- Problems with flat file databases
- Locking
- Complex data
- Efficiency
- Chapter summary
- 4. Relational databases
- In this chapter...
- Tables and relationships
- Structured Query Language
- General syntax
- Chapter summary
- 5. MySQL
- In this chapter...
- MySQL features
- General features
- Cross-platform compatibility
- Comparisions with other popular DBMSs
- PostgreSQL
- mSQL
- Oracle, Sybase, etc
- Getting MySQL
- Redhat Linux
- Debian Linux
- Compiling from source
- Binaries for other platforms
- Setting up MySQL databases
- Creating the Acme inventory database
- Setting up permissions
- Creating tables
- The MySQL client
- Understanding the MySQL client prompts
- Exercises
- Chapter summary
- 6. The DBI and DBD modules
- In this chapter...
- What is DBI?
- Supported database types
- How does DBI work?
- DBI/DBD syntax
- Variable name conventions
- Connecting to the database
- Executing an SQL query
- Doing useful things with the data
- An easier way to execute non-SELECT queries
- Quoting special characters in SQL
- Exercises
- Advanced exercises
- Chapter summary
- 7. Acme Widget Co. Exercises
- In this chapter...
- The Acme inventory application
- Listing stock items
- Advanced exercises:
- Adding new stock items
- Advanced exercises
- Entering a sale into the system
- Creating sales reports
- Advanced exercises
- Searching for stock items
- Advanced exercises
- 8. References (Optional topic)
- In this chapter...
- Creating and deferencing
- Complex data structures
- Passing multiple arrays/hashes as arguments
- Anonymous data structures
- Chapter summary
- 9. Conclusion
- What you've learnt
- Where to now?
- Further reading
- Books
- Online
- A. Unix cheat sheet
- B. Editor cheat sheet
- vi
- Running
- Using
- Exiting
- Gotchas
- Help
- pico
- Running
- Using
- Exiting
- Gotchas
- Help
- joe
- Running
- Using
- Exiting
- Gotchas
- Help
- jed
- Running
- Using
- Exiting
- Gotchas
- Help
- C. ASCII Pronunciation Guide
Chapter 1. Introduction
Welcome to Netizen's Database Programming with Perl training course.This is a one-day course in which you will learn how to writedatabase-backed websites using Perl and and the powerful DBI module.
Course outlineAbout databases
Text based ("flat file") databases
Relational databases
Tables and relationships
Structured Query Language (SQL)
MySQL and other database servers
Features of MySQL
Getting MySQL
Setting up MySQL databases
The MySQL client
The DBI and DBD modules
What is DBI?
DBI syntax
DBI exercises
Extended exercises
References (optional topic)
Assumed knowledgeIt is assumed that you know and understand the following topics:
Unix - logging in, creating and editing files
Perl - variable types, operators and functions, conditionalconstructs, subroutines, basic regular expressions
Basic database theory - tables, records, fields
If you need help with editing files under Unix, a cheat-sheet isavailable in Appendix A and an editor command summary in Appendix B. The Unix operating system commands you willneed are mentioned and explained very briefly throughout the course -please feel free to ask if you need more help. The required Perlknowledge was covered in Netizen's "Introduction to Perl" trainingmodule. Some of the material taught in "Intermediate Perl" is alsouseful to this module.
Module objectivesUnderstand what a database is and use correct terminology to describe types of databases and parts of databases
Understand and use flat file or textual databases withPerl
Understand the advantages and limitations of flat file or textual databases and relational databases
Understand and use Structured Query Language (SQL) to manipulate data in a relational database
Know about MySQL and other relational databases suitable for small to medium applications
Use the MySQL command line client to perform SQL queries
Understand and use Perl's DBI module to interact with databases
Use the skills and knowledge learnt in this module to create a sample application
Platform and version detailsThis module is taught using Unix or a Unix-like operating system. Mostof what is learnt will work equally well on Windows NT or otheroperating systems; your instructor will inform you throughout the courseof any areas which differ.
All Netizen's Perl training courses use Perl 5, the most recent majorrelease of the Perl language. Perl 5 differs signficantly from previousversions of Perl, so you will need a Perl 5 interpreter to use what youhave learnt. However, older Perl programs should work fine under Perl5.
The database server used during this module is MySQL, available fromhttp://www.mysql.com. We have chosen it because it is free for mostpurposes, runs on many platforms, is the most common database used byISPs offering database services to web hosting clients, and has a good feature set for our purposes. However, all the Perl code examples given in this module willwork equally well with any of a number of database systems, includingPostgreSQL, Oracle, Sybase, and Informix.
The course notesThese course notes contain material which will guide you through thetopics listed above, as well as appendices containing other usefulinformation.
The following typographic conventions are used in these notes:
System commands appear in this typeface
Literal text which you should type in to the command line or editorappears as monospaced font.
Keystrokes which you should type appear like this:ENTER. Combinations of keys appear like this:CTRL-D
Program listings and other literal listings of what appears on thescreen appear in a monospaced font like this.Parts of commands or other literal text which should be replaced by your own specific values appears like this
Note: Notes and tips appear offset from the text like this.
Advanced: Notes which are marked "Advanced" are for those who are racing ahead orwho already have some knowledge of the topic at hand. The informationcontained in these notes is not essential to your understanding of thetopic, but may be of interest to those who want to extend theirknowledge.
Readme: Notes marked with "Readme" are pointers to more information which can befound in your textbook or in online documentation such as manual pagesor websites.
Other materialsIn addition to these notes, you should have a copy of the required textbook for this course: Programming Perl (2nd ed.) by Schwartz,Wall, and Christiansen (published by O'Reilly and Associates) -- morecommonly referred to as "the Camel book". The Camel book will be usedthroughout the day, and will be a valuable reference to take home andkeep next to your computer.
You will also have received a floppy disk containing these notes in HTMLform (with working links to external resources etc) and all the examplescripts and data used in this course.
Lastly, you will have been given a nametag with your name and company onthe front, and a username and password on the back.
Chapter 2. About databases
In this chapter...This chapter talks about databases in general, and the different typesof databases which can be used with Perl.
What is a database?
Types of databasesThere are many different types of databases, including:
Relational databases are by far the most useful type commonly available,and this training module focusses largely on them, after looking brieflyat flat file text databases.
Database management systemsA database management system (DBMS) is a collection of software whichcan be used to create, maintain and work with databases. Aclient/server database system is one in which the database is stored andmanaged by a database server, and client software is used to requestinformation from the server or to send commands to the server.
Uses of databasesDatabases are commonly used to store bodies of data which are too largeto be managed on paper or through simple spreadsheets. Most businessesuse databases for accounts, inventory, personnel, and other recordkeeping. Databases are also becoming more widely used by home users foraddress books, cd collections, recipe archives, etc. There are very fewfields in which databases cannot be used.
Chapter summaryA database is a collection of related information.
Data stored in a database is persistent
There are a number of different types of databases, including flat file, relational, and others
Database management systems are collections of software used to manage databases
Databases are widely used in manyfields
Chapter 3. Textfiles as databases
In this chapter...In this chapter we investigate text-based or "flat file" databases andhow to use Perl to manipulate them. We also discuss some of thelimitations of this database format.
Delimited text filesA delimited text file is one in which each line of text is a record, andthe fields are separated by a known character.
The character used to delimit the data varies according to the type ofdata. Common delimiters include the tab character(\t in Perl) or various punctuation characters. Thedelimiter should always be one which does not appear in the data.
Delimited text files are easily produced by most desktop spreadsheet anddatabase applications (eg Microsoft Excel, Microsoft Access). You canusually choose "File" then "Save As" or "Export", then select the typeof file you would like to save as.
Imagine a file which contains peoples' given names, surnames, and ages,delimited by the pipe (|) symbol:
Fred|Flintstone|40Wilma|Flintstone|36Barney|Rubble|38Betty|Rubble|34Homer|Simpson|45Marge|Simpson|39Bart|Simpson|11Lisa|Simpson|9The file above is available in your exercises directory asdelimited.txt.
Reading delimited text filesTo read from a delimited text file:
#!/usr/bin/perl -wuse strict;open (INPUT, "delimited.txt") or die "Can't open data file: $!";while (<INPUT>) { chomp; # remove newline my @fields = split(/\|/, $_); print "$fields[1], $fields[0]: $fields[2]\n";}close INPUT;This should print out:
Flintstone, Fred: 40Flintstone, Wilma: 36...And so on.
Searching for recordsOne of the common uses of databases is to search for specific records.
#!/usr/bin/perl -wuse strict;# Find out what record the user wants:print "Search for: ";chomp (my $search_string = <STDIN>);open (INPUT, "delimited.txt") or die "Can't open data file: $!";while (<INPUT>) { chomp; # remove newline my @fields = split(/\|/, $_); # test whether the search string matches given or family name if ($fields[0] =~ /$search_string/ or $fields[1] =~ /$search_string/) { print "$fields[1], $fields[0]: $fields[2]\n"; }}close INPUT;
Sorting recordsSorting records from a flat text database can be quite difficult.Simply sorting the items line by line is one simplistic approach:
#!/usr/bin/perl -wuse strict;open (INPUT, "delimited.txt") or die "Can't open data file: $!";my @records = sort <INPUT>;foreach (@records) { chomp; # remove newline my @fields = split(/\|/, $_); print "$fields[1], $fields[0]: $fields[2]\n";}close INPUT;The above technique can only sort on the first field of the data (in thecase of our example, that would be the given name) and may havedifficulties when it encounters the delimiter.
To sort by any other field, we would first need to load the data into alist of lists (using references), then use the sort()function's optional first argument to specify a subroutine to use forsorting:
#!/usr/bin/perl -wuse strict;open (INPUT, "delimited.txt") or die "Can't open data file: $!";while (<INPUT>) { chomp; my @this_record = split(/\|/, $_); # build a list-of-lists containing references to each record push (@records, \@this_record);}# sort takes an optional argument of what subroutine to use to sort# the data...my @sorted = sort given_name_order @records;foreach $record (@sorted) { # we have to print the items via a reference to the array... print "$record->[1], $record->[0]: $record->[2]\n";}# subroutine to implement sorting ordersub given_name_order { $a->[0] cmp $b->[0];}
Obviously this can be quite tricky, especially if the programmer is nottotally familiar with Perl references. It also requires loading the entire data set into memory, which would be very inefficient for large databases.
Writing to delimited text filesThe most useful function for writing to delimited text files isjoin, which is the logical equivalent ofsplit.
#!/usr/bin/perl -wuse strict;open OUTPUT, ">>delimited.txt" or die "Can't open output file: $!";my @record = qw(George Jetson 35);print OUTPUT join("|", @record), "\n";
Comma-separated variable (CSV) filesComma separated variable files are another format commonly produced byspreadsheet and database programs. CSV files delimit their fields withcommas, and wrap textual data in quotation marks, allowing the textualdata to contain commas if required:
"Fred","Flintstone",40"Wilma","Flintstone",36"Barney","Rubble",38"Betty","Rubble",34"Homer","Simpson",45"Marge","Simpson",39"Bart","Simpson",11"Lisa","Simpson",9CSV files are harder to parse than ordinary delimited text files. Thebest way to parse them is to use the Text::ParseWords module:
#!/usr/bin/perl -wuse strict;use Text::ParseWords;open INPUT, "csv.txt" or die "Can't open input file: $!";while (<INPUT>) { my @fields = quotewords("," 0, $_);}The three arguments to the quotewords() routine are:
The delimiter to use
Whether to keep any backslashes that appear in the data (zero for no, one for yes)
A list of lines to parse (in our case, one line at a time)
Problems with flat file databasesLockingWhen using flat file databases without locking, problems can occur if two or more people open the files at the same time. This can cause data to be lost orcorrupted.
If you are implementing a flat file database, you will need to handlefile locking using Perl's flock function.
Complex dataIf your data is more complex than a single table of scalar items,managing your flat file database can become extremely tedious anddifficult.
EfficiencyFlat file databases are very inefficient for large quantities of data.Searching, sorting, and other simple activities can take a very longtime and use a great deal of memory and other system resources.
Chapter summaryThe two main types of text database use either delimited text or comma separated variables to store data
Delimited text can be read using Perl's split function and written using the join function
Comma separated files are most easily read using the Text::ParseWords module
There are several problems with flat file databases including locking, efficiency, and difficulties in handling more complex data
Chapter 4. Relational databases
In this chapter...The first section of this training session focuses on database theory, and covers relational database systems, and SQL - the language used to talk tothem.
Tables and relationshipsIn a relational database, data is stored in tables. Each table containsdata about a particular type of entity (either physical or conceptual).
For instance, our sample database is the inventory and sales system forAcme Widget Co. It has tables containing data for the followingentities:
Table 4-1. Acme Widget Co Tables
TableDescription
stock_itemInventory items
customerCustomer account details
salepersonSales people working for Acme Widget Co.
salesSales events which occur
Tables in a database contain fields and records. Each record describes one entity. Each field describes a single item of data for that entity.You can think of it like a spreadsheet, with the rows being the recordsand the columns being the fields, thus:
Table 4-2. Sample table
ID numberDescriptionPriceQuantity in stock
1widget$9.9512
2gadget$3.2720
Every table must have a primary key, which is a field whichuniquely identifies the record. In the example above, the Stock IDnumber is the primary key.
The following figures show the tables used in our database, along withtheir field names and primary keys (in bold type).
Table 4-3. the stock_item table
stock_item
id
description
price
quantity
Table 4-4. the customer table
customer
id
name
address
suburb
state
postcode
Table 4-5. the salesperson table
salesperson
id
name
Table 4-6. the sales table
sales
id
sale_date
salesperson_id
customer_id
stock_item_id
quantity
price
Structured Query LanguageSQL is a semi-English-like language used to manipulate relationaldatabases. It is based on an ANSI standard, though very few SQLimplementations actually adhere to the standard.
SQL statements are mostly case insensitive these days. While most books and references use upper-case, these notes use lower-casethroughout for readability, and because the likelihood of needing todeal with older databases which only understand upper-case is becomingincreasingly slim.
The syntax given in these coursenotes is cut down for simplicity; forfull information, consult your database system's documentation. TheMySQL documentation is available on our system in/usr/doc/mysql-doc and /usr/doc/mysql-manual,or by pointing your web browser at http://training.netizen.com.au/.
General syntaxSQL is case usually insensitive, apart from table and field names (whichmay or may not be case sensitive depending on what platform you're on --on Unix they are usually case sensitive, on Windows they usuallyaren't).
String data can be delimited with either double or single quotes.Numerical data does not need to be delimited.
Wildcards may be used when searching for string data. A %(percent) sign is used to indicated multiple characters (much as anasterisk is used in DOS or Unix filename wildcards) while the underscorecharacter (_) can be used to indicate a single character,similar to the ? under Unix or DOS.
The following comparison operators may be used:
Table 4-7. Comparison Operators
OperatorMeaning
=Equality
>Greater than
<Less than
>=Greater than or equal to
<=Less than or equal to
<>Inequality
likeWildcard matching
In the following syntax examples, the term condition isused as shorthand for any expression which can be evaluated for truth,for instance 2 + 2 = 4 or name like "A%".
Conditions may be combined by using and andor; use round brackets to indicate precedence. Forinstance, name like "A%" or name like "B%" will find allrecords where the ``name'' field starts with A or B.
SELECTAn SQL select statement is used to select certain rows from atable or tables. A select query will return as many rows as match thecriteria.
Syntaxselect field1 [, field2, field3] from table1 [, table2] where condition order by field [desc]
Examplesselect id, name from customer;select id, name from customer order by name;select id, name from customer order by name desc;We can use a select statement to obtain data from multiple tables. Thisis referred to as a ``join''.
select * from customer, sales where customer.id = sales.customer_id
INSERTAn insert query is used to add data to the database, a rowat a time.
Note: The columns names are optional to make typing queries easier.This is fine for interactive use, however it is very bad practice to omit themin programs. Always specify column names ininsert statements.
Syntaxinsert into tablename (col_name1, col_name2, col_name3) values (value1, value2, value3);
Examplesinsert into stock_item (id, description, price, quantity) values (0, 'doodad', 9.95, 12);Note that since the id field is anauto_increment field in the Acme inventory database we've set up, we don't need to specify a value togo in there, and just use zero instead --- whatever we specify will be replaced with the auto-incremented value. Auto-increment fields of somekind are available in most database systems, and are very useful forcreating unique ID numbers.
DELETEA delete query can be used to delete rows which match agiven criteria.
Syntaxdelete from tablename where condition
Examplesdelete from stock_item where quantity = 0;
UPDATEThe update query is used to change the values of certainfields in existing records.
Syntaxupdate tablename set field1 = expression, field2 = expression where condition
Examplesupdate stock_item set quantity = (quantity - 1) where id = 4;
CREATEThe create statement is used to create new tables in the database.
Syntaxcreate table tablename ( column coltype options, column coltype options, ... primary key (colname))Data types include (but are not limited to):
Table 4-8. Some data types
INTan integer number
FLOATa floating point number
CHAR(n)character data of exactly n characters
VARCHAR(n)character data of up to n characters (field grows/shrinks to fit)
BLOBBinary Large OBject
DATEA date in YYYY-MM-DD format
ENUMenumerated string value (eg "Male" or "Female")
Data types vary slightly between different database systems. The fullrange of MySQL data types is outlined in section 7.2 of the MySQL reference manual.
Examplescreate table contactlist ( id int not null auto_increment, name varchar(30), phone varchar(30), primary key (id))
DROPThe drop statement is used to delete a table from the database.
Syntaxdrop table tablename
Exampledrop table contactlist
Chapter summaryA database table contains fields and records of data about one entity
SQL (Structured Query Language) can be used to manipulate andretrieve data in a database
A SELECT query may be used to retrieve records whichmatch certain criteria
An INSERT query may be used to add new records to thedatabase
A DELETE query may be used to delete records from thedatabase
An UPDATE query may be used to modify records in thedatabase
A CREATE query may be used to create new tables in thedatabase
A DROP query may be used to remove tables from thedatabase
Chapter 5. MySQL
In this chapter...In this section we examine the popular database MySQL, which isavailable for free for many platforms. MySQL is just one of manydatabase systems which can be accessed via Perl's DBI module.
MySQL featuresGeneral featuresFast
Lightweight
Command-line and GUI tools
Supports a fairly large subset of SQL, including indexing, binaryobjects (BLOBs), etc
Allows changes to structure of tables while running
Wide userbase
Support contracts available
Cross-platform compatibilityAvailable for most Unix platforms
Available for Windows NT/95/98 (there are license differences)
Available for OS/2
Programming libraries for C, Perl, Python, PHP, Java, Delphi, Tcl,Guile (a scheme interpreter), and probably more...
Open-source ODBC
Comparisions with other popular DBMSsPostgreSQLMySQL and PostgreSQL are very similar in many ways. The maindifferences are that PostgreSQL is an object database system rather than apurely relational database system, it has transactions (but itsperformance suffers because of this) and that PostgreSQL is distributed under the GNU General Public License (GPL) rather than a license which imposes some restrictions or costs on use and redistribution.
More information: http://www.postgresql.org/
mSQLmSQL is also similar to MySQL but has slightly less features and is notfree for commercial use. On the positive side, it is very lightweightand can be very fast for simple SELECT queries.
More information: http://www.hughes.com.au/
Oracle, Sybase, etcMySQL will not give you the performance or features of Oracle or otherenterprise-level database management systems. In particular, MySQLlacks transactions, triggers, and views. The price you pay for this isthat Oracle costs a lot, and requires heavy hardware to run on. MySQL is better suited to small-to-medium database applications such as web-based database applications, and will do so happily on a common Pentium basedsystem.
More information: http://www.oracle.com/
Getting MySQLMySQL can be downloaded from http://www.mysql.com/or mirror sites worldwide. It is also available in packaged binary format for variousoperating system distributions, including RedHat and Debian linux.
Installation instructions come with the software, but in brief: