Saturday, April 28, 2018

Setup KOHA on Ubuntu

echo deb http://debian.koha-community.org/koha stable main | sudo tee /etc/apt/sources.list.d/koha.list

wget -O- http://debian.koha-community.org/koha/gpg.asc | sudo apt-key add -

sudo apt-get update
sudo apt-get upgrade

sudo apt-get clean

sudo apt-get install koha-common

sudo apt-get install mariadb-server


sudo nano /etc/koha/koha-sites.conf
INTRAPORT="8080"

sudo nano /etc/apache2/ports.conf
Listen 80
Listen 8080

sudo a2enmod rewrite
sudo a2enmod cgi
sudo a2enmod deflate


sudo service apache2 restart



sudo koha-create --create-db library

sudo chown mysql.root /var/log/mysql/error.log && sudo chmod 640 /var/log/mysql/error.log



sudo a2ensite library
sudo a2dissite 000-default [disable default to enable OPAC]

sudo service apache2 restart

Run the next command to get password for user koha_library
sudo xmlstarlet sel -t -v 'yazgfs/config/pass' /etc/koha/sites/library/koha-conf.xml;echo

KOHA server is ready!, login to the site to complete setup steps
http://ServerIP:8080
get the login information from previous setp

Setup screens sample
https://koha-community.org/manual/17.11/en/html/01_installation.html



sudo koha-translate --list --available
sudo koha-translate --install ar-Arab

For more information about Translation

https://wiki.koha-community.org/wiki/Installation_of_additional_languages_for_OPAC_and_INTRANET_staff_client






ENABLE CACHE IN KOHA (enhance the speed of Koha)


sudo su
sudo koha-plack --enable library
sudo koha-plack --start  library
sudo service apache2 restart





Enable ARABIC SEARCH IN KOHA


First, Install yaz-icu package:
sudo apt-get install yaz-icu
In the next file, update the next two lines in yellow 
nano /etc/koha/zebradb/etc/default.idx 
# Traditional word index
# Used if completenss is 'incomplete field' (@attr 6=1) and
# structure is word/phrase/word-list/free-form-text/document-text
index w
completeness 0
position 1
alwaysmatches 1
firstinfield 1
icuchain words-icu.xml


# Phrase index
# Used if completeness is 'complete {sub}field' (@attr 6=2, @attr 6=1)
# and structure is word/phrase/word-list/free-form-text/document-text
index p
completeness 1
firstinfield 1
icuchain phrases-icu.xml 
Optional : In the same folder update words-icu.xml with:
<icu_chain locale="ar">
<transliterate rule="\'>\ "/>
<transliterate rule="[:Number:] { '-' > "/>
<transform rule="[:Control:] Any-Remove"/>
<tokenize rule="l"/>
<transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
<transform rule="NFD"/>
<transform rule="[:Nonspacing Mark:] Remove"/>
<transform rule="NFC"/>
<transliterate rule="{ الا > ا "/>
<transliterate rule="{ الأ > أ "/>
<transliterate rule="{ الإ > إ "/>
<transliterate rule="{ الآ > آ "/>
<transliterate rule="{ الب > ب "/>
<transliterate rule="{ الت > ت "/>
<transliterate rule="{ الث > ث "/>
<transliterate rule="{ الج > ج "/>
<transliterate rule="{ الح > ح "/>
<transliterate rule="{ الخ > خ "/>
<transliterate rule="{ الد > د "/>
<transliterate rule="{ الذ > ذ "/>
<transliterate rule="{ الر > ر "/>
<transliterate rule="{ الز > ز "/>
<transliterate rule="{ الس > س "/>
<transliterate rule="{ الش > ش "/>
<transliterate rule="{ الص > ص "/>
<transliterate rule="{ الض > ض "/>
<transliterate rule="{ الط > ط "/>
<transliterate rule="{ الظ > ظ "/>
<transliterate rule="{ الع > ع "/>
<transliterate rule="{ الغ > غ "/>
<transliterate rule="{ الف > ف "/>
<transliterate rule="{ الق > ق "/>
<transliterate rule="{ الك > ك "/>
<transliterate rule="{ الل > ل "/>
<transliterate rule="{ الم > م "/>
<transliterate rule="{ الن > ن "/>
<transliterate rule="{ اله > ه "/>
<transliterate rule="{ الو > و "/>
<transliterate rule="{ الي > ي "/>
<display/>
<casemap rule="l"/>
</icu_chain>
(note that searching for other locales will still work even if you have your locale set to ar)
If you are using packages, run:
sudo koha-zebra --restart 
cd /tmp && sudo koha-rebuild-zebra -f library

OR

/etc/init.d/koha-zebra-daemon restart
/usr/share/koha/bin/migration_tools/rebuild_zebra.pl -b -r -v -w









Enable Arabic Search
http://arkoha.blogspot.com.eg/2012/10/blog-post_26.html
https://wiki.koha-community.org/wiki/Correcting_Search_of_Arabic_records
http://arkoha.blogspot.com.eg/2015/02/search-Arabic-KohaPackages.html


For more information about steps
https://community.spiceworks.com/how_to/146465-install-koha-17-05-on-ubuntu-16-04-digitalocean-with-mariadb
https://wiki.koha-community.org/wiki/Koha_on_ubuntu_-_packages




Rebuild Zebra Search Index:
Koha-rebuild-zebra -f -v -b library
You can use these lines to restart the search tables.
sudo zebraidx -c /etc/koha/sites/library/zebra-biblios.cfg drop biblios
sudo zebraidx -c /etc/koha/sites/library/zebra-biblios.cfg commit 
koha-rebuild-zebra -b -r -v library
  • Rebuild parameters (source):
  • -f, --full Does a reindex of the whole collection. Will run even if USE_INDEXER_DAEMON=yes.
  • -a, --authorities Only run the indexing process for authority records.
  • -b, --biblios Only run the indexing process for biblio records.
  • -q, --quiet Sometimes be a bit quieter for scripts/cronjobs.
  • -v, --verbose Be verbose. Useful for debugging indexing problems.





Backup/Restore KOHA DATABASE 


 1. Backup of  old Koha databse 
mysqldump -uroot -p koha_library | xz > koha_library.sql.xz

2. Restoration of old Koha database to new koha database
   mysql -u root -p koha_library <  koha_library.sql.xz
   
3. Upgrade Database Schema
 run the command
sudo su
koha-upgrade-schema library

4. Then Rebuild the Zebra Index.
sudo koha-rebuild-zebra -v -f library






KOHA DELETE ALL BIBLIO RCORDS


mysql -u root -p
use koha_library;
SET FOREIGN_KEY_CHECKS=0;

TRUNCATE items;
TRUNCATE deleted_items;

TRUNCATE biblioitems;
TRUNCATE biblio;
TRUNCATE deletedbiblioitems;
TRUNCATE deletedbiblio;

Delete transactions (Issue, return)
TRUNCATE old_issues;
TRUNCATE issues;

Delete borrowers details
TRUNCATE borrowers;
TRUNCATE deletedborrowers;

SET FOREIGN_KEY_CHECKS=1;


No comments: