One of a series of test instances for migrating the Koha Wiki MediaWiki database.
For the current Koha Wiki, visit https://wiki.koha-community.org .Upgrading 2.2
Upgrading from Koha 2.2 to Koha 3.0
(including specific notes for UNIMARC)
This page was called 22_to_30 on the old wiki.
Packages / softwares to update and/or add
- apt-get install libexpat1-dev on Debian : libexpat is used by zebra
- install yaz ( from http://www.indexdata.dk/yaz/ This one is already here, but you must update it, as there is a new version)
- install zebra ( from http://www.indexdata.dk/zebra/ )
- Perl packages :
perl -MCPAN -e 'install HTML::Template::Pro' perl -MCPAN -e 'install Lingua::Stem' perl -MCPAN -e 'install MARC::Record' (This one is already here, but you must update it, as there is a new version) perl -MCPAN -e 'install MARC::File::XML' (This one is already here, but you must update it, as there is a new version) perl -MCPAN -e 'install MARC::Charset' (This one is already here, but you must update it, as there is a new version) perl -MCPAN -e 'install XML::LibXML::SAX::Parser'
Configuration files to update and/or add
- write /etc/koha.xml (from the sample below and your actual /etc/koha.conf)
- Update apache virtual host (/etc/koha-httpd.conf) to point to Koha 3.0 :
- DocumentRoot (DocumentRoot /path/to/koha30/)
- ScriptAlias (ScriptAlias /cgi-bin/koha/ /path/to/koha3.0 for librarian interface, /path/to/koha3.0/opac for OPAC)
- (PERL5LIB (PERL5LIB /path/to/koha3.0)
- SetEnv (SetEnv KOHA_CONF=/etc/koha.xml)
- restart apache
Koha datas to update and/or add
- export PERL5LIB=/path/to/koha
- export KOHA_CONF=/path/to/koha.xml
- installer/data/mysql/update22to30.pl That will update the database to the 3.0 structure. Go and take a coffee, it can be long or very long, depending on your Database size.
if you get :
alter or create id in aqbooksellers DBD::mysql::db do failed: Multiple primary key defined at updater/updatedatabase line 1803.
manually update aqbookseller table :
ALTER TABLE `aqbooksellers` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT
but before doing this, you may have to clean aqbooksellers and/or aqorders from any empty line (id=0) or duplicate entries (2 booksellers with the same id) if you get
moving bibliothesaurus to InnoDB DBD::mysql::db do failed:
The used table type doesn't support FULLTEXT indexes at installer/data/mysql/update22to30.pl line 1729. don't worry
- in mySQL DROP TABLE `auth_word` , `marc_word` ;
- installer/data/mysql/updatedatabase.pl this script will finish the update of the database.
If you see :
DBD::mysql::db do failed: Duplicate entry 'XXXX' for key 1 at installer/data/mysql/updatedatabase.pl line YYY
don't worry
- bin/migration_tools/22_to_30/move_marc_to_biblioitems.pl
- bin/migration_tools/22_to_30/move_marc_to_authheader.pl
- bin/migration_tools/22_to_30/rebuild_unimarc_100.pl to update field 100 -unicode-. ONLY if you are using UNIMARC. Otherwise, things will look OK, but when you update the biblio, diacritics will go crazy
- bin/migration_tools/22_to_30/missing090field.pl to check that no 090 fields are missing.
- in mysql console or phpMyAdmin : DROP TABLE `marc_subfield_table`, `auth_subfield_table`, `marc_biblio`, `marc_blob_subfield`
You should now be able to login to Koha, but you can't search yet.
- update the following systempreferences (Koha > More > Administration > Systempreference :
- StaffClient TemplateEncoding : utf-8
- StaffClient Intranetcolorstylesheet : blue.css (to have some blue colors. This step is not required, you can skip it)
- StaffClient Template : prog
- OPAC features : activate what you want
- Logs : activate what you want
- Borrowers : update BorrowerMandatoryFields, BorrowerTitles, and borrowerRelationShip to fit your needs
- Koha admin / itemtypes : choose some nice new pictures for each itemtype
- Borrower categories : warning, the subscription duration is now in MONTHS. Update the categories (and super-categories if needed : all categories are declared as “Adults”.
- check that, in all your frameworks, the items.onloan field is mapped to a MARC subfield. In UNIMARC, it should be 995$n. If it's not the case, then to the mapping. The subfield does not need to be visible (in items (10) tab)
- update the onloan field (in mySQL). In 2.2, it was default 0000-00-00, in koha 3, the default must be NULL :
ALTER TABLE `items` CHANGE `onloan` `onloan` DATE NULL; UPDATE items SET onloan=NULL WHERE onloan='0000-00-00';
now that the onloan field is correct, we must fill it. To do that, run the following SQL :
UPDATE items SET onloan=(SELECT max(date_due) FROM issues WHERE issues.itemnumber=items.itemnumber AND returndate is NULL)
if will populate the onloan field with appropriate values
- rebuild some datas by running misc/migration_tools/upgradeitems.pl
Zebra / NoZebra stuff
Zebra
- misc/migration_tools/rebuild_zebra.pl -a -b -k –reset to build the zebra database for authoritiess (-a), biblios (-b), keep export just in case (-k) and empty the zebra database (–reset) before rebuilding it
- check that all default zebra files fit your needs (a standard UNIMARC should be OK), otherwise modify
- misc/migration_tools/rebuild_zebra.pl -a -b -k -s –reset to rebuild the zebra DB if needed. the -s will skip the Koha export (will be much much faster if you have a lot of datas )
- zebrasrv -f /path/to/koha-config.xml will make zebra run. Once you have checked that things are OK, you'll probably have zebrasrv as a service launched at startup automatically (not explained in here)
NoZebra stuff
- set NoZebra ON, in systempreferences, cataloguing, syspref called NoZebra
- fill NoZebraIndexes syspref to define your indexes. Below are samples for UNIMARC and MARC21 databases.
- misc/migration_tools/rebuild_nozebra.pl should be enough to reindex your datas and have a searchable catalog. The tool 1st load all your biblios, then rebuild the entire index in one step. Go to take a coffe, it is quite long.
UNIMARC NoZebraIndexes sample
'title' => '200a,200c,200d,200e,225a,225d,225e,225f,225h,225i,225v,500*,501*,503*,510*,512*,513*,514*,515*,516*,517*,518*,519*,520*,530*,531*,532*,540*,541*,545*,604t,610t,605a', 'author' =>'200f,600a,601a,604a,700a,700b,700c,700d,700a,701b,701c,701d,702a,702b,702c,702d,710a,710b,710c,710d,711a,711b,711c,711d,712a,712b,712c,712d', 'isbn' => '010a', 'issn' => '011a', 'biblionumber' =>'0909', 'itemtype' => '200b', 'language' => '101a', 'publisher' => '210c', 'date' => '210d', 'note' => '300a,301a,302a,303a,304a,305a,306az,307a,308a,309a,310a,311a,312a,313a,314a,315a,316a,317a,318a,319a,320a,321a,322a,323a,324a,325a,326a,327a,328a,330a,332a,333a,336a,337a,345a', 'Koha-Auth-Number' => '6009,6019,6029,6039,6049,6059,6069,6109,7009,7019,7029,7109,7119,7129', 'subject' => '600*,601*,606*,610*', 'dewey' => '676a', 'host-item' => '995a,995c'
MARC21 NoZebraIndexes sample
'title' => '130a,210a,222a,240a,243a,245a,245b,246a,246b,247a,247b,250a,250b,440a,830a', 'author' => '100a,100b,100c,100d,110a,111a,111b,111c,111d,245c,700a,710a,711a,800a,810a,811a', 'isbn' => '020a', 'issn' => '022a', 'lccn' => '010a', 'biblionumber' => '999c', 'itemtype' => '942c', 'publisher' => '260b', 'date' => '260c', 'note' => '500a, 501a,504a,505a,508a,511a,518a,520a,521a,522a,524a,526a,530a,533a,538a,541a,546a,555a,556a,562a,563a,583a,585a,582a', 'subject' => '600*,610*,611*,630*,650*,651*,653*,654*,655*,662*,690*', 'dewey' => '082', 'bc' => '952p', 'callnum' => '952o', 'an' => '6009,6109,6119', 'homebranch' => '952a,952c'
koha.xml sample
<yazgfs> <listen id="biblioserver" >tcp:@:9902</listen> <listen id="authorityserver">tcp:@:2102</listen> <server id="biblioserver" listenref="biblioserver"> <directory>/home/zebradbs/biblios</directory> <config>/home/zebradbs/biblios/etc/zebra-biblios.cfg</config> <cql2rpn>/home/zebradbs/biblios/etc/pqf.properties</cql2rpn> </server> <serverinfo id="biblioserver"> <ccl2rpn>/home/zebradbs/biblios/etc/ccl.properties</ccl2rpn> <user>kohaadmin</user> <password>K0h4R0ck$</password> </serverinfo> <server id="authorityserver" listenref="authorityserver" > <directory>/home/zebradbs/authorities</directory> <config>/home/zebradbs/authorities/etc/zebra-authorities.cfg</config> <cql2rpn>/home/zebradbs/authorities/etc/pqf.properties</cql2rpn> </server> <serverinfo id="authorityserver"> <ccl2rpn>/home/zebradbs/authorities/etc/ccl.properties</ccl2rpn> <user>kohaadmin</user> <password>K0h4R0ck$</password> </serverinfo> <config> <database>mysql_Database_usually_koha</database> <hostname>mysql_server_usually_localhost</hostname> <user>login</user> <pass>password</pass> <kohaversion>3.0</kohaversion> <biblioserver>biblios</biblioserver> <biblioservershadow>1</biblioservershadow> <authorityserver>authorities</authorityserver> <authorityservershadow>1</authorityservershadow> <intranetdir>/path/to/koha/</intranetdir> <opacdir>/path/to/koha/opac</opacdir> <opachtdocs>/path/to/koha/koha-tmpl/opac-tmpl</opachtdocs> <intrahtdocs>/path/to/koha/koha-tmpl/intranet-tmpl</intrahtdocs> <includes>/path/to/koha/koha-tmpl/intranet-tmpl/prog/en/includes</includes> </config> </yazgfs>
Troubleshooting
Encoding
You may get diacritics wrong in biblios after the update. This seems to happen because mysql 4.0 says/think your datas are using encoding X while they are not. We (BibLibre) have experimented that using the flag --default-character-set=latin1 when retrieving your datas can solve the problem