LINUX, FOSS AND LIBRARY TECHNOLOGY ENTHUSIAST

Thursday, February 13, 2020

Install Koha on Ubuntu

17 comments
Koha is the first Open Source Integrated Library Management System (ILMS) which includes Acquisition, Cataloguing, Circulation, Serial Control & Online Public Access Catalogue with many more advanced features. Koha supports International library standards and protocols which ensures interoperability between Koha & any other library management system. It supports technologies and international standards such as MARC 21, RFID, z39.50, web 2.0, etc. The software is fully customizable and includes all modules expected in any standard library management system.

Installing Koha — overview
  • Hardware Requirement (PC): Processor: Intel i3, 2.6 GHz or higher 
  • RAM: 4 GB
  • HDD: 500 GB
  • DVD/USB Drive
Koha minimum software requirements
  •    Linux: Debian (Officially recommended) or Ubuntu (with LTS) but other Debian/Ubuntu Linux flavors can also be used.
  •    Apache: Webserver
  •    MySQL/MariaDB: Relational Database
  •    PERL: Programming language: lots of Perl dependencies
Installation methods
    From source/git
    apt-get and pre-built packages [make everything easy]

Ubuntu package commands:

NB: these commands have been tested with the latest Ubuntu LTS ( 20.04 Focal Fossa)

Open Applications > System Tools > Terminal and execute the below commands one by one

Update Ubuntu using apt

sudo apt update && sudo apt upgrade -y

Clear the apt-get packager manager cache

sudo apt clean

Install MariaDB-server dependence

sudo apt install -y mariadb-server

Provide MySQL/MariaDB root password

(If the password asks during the installation process, enter the password in the window. Apply the following command, if the password window did not appear during the installation secure it)

Securing MariaDB

Run this command to improve the security of the MariaDB installation:

sudo mysql_secure_installation

(The script will prompt you to set up the root user password, remove the anonymous user, restrict root user access to the local machine and remove the test database. In the end, the script will reload the privilege tables ensuring that all changes take effect immediately. All steps are explained in detail and it is recommended to answer “Y” (yes) to all questions.)

Add Koha community repository (If you want stable/latest version of koha change oldstable to stable)

sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/koha-keyring.gpg] https://debian.koha-community.org/koha oldstable main" >> /etc/apt/sources.list.d/koha.list'

Add trusted repository key

sudo sh -c 'wget -qO - https://debian.koha-community.org/koha/gpg.asc | gpg --dearmor -o /usr/share/keyrings/koha-keyring.gpg'

Update software repository

sudo apt update

Install Koha and dependencies

sudo apt install -y koha-common

( takes 5 mins on a reasonably fast internet connection )

Edit initial config file

sudo vim /etc/koha/koha-sites.conf


Edit INTRAPORT as 8080OPACPORT as 80, domain, and Memcached [for database, makes Koha faster] settings depending on install

Ensure rewrite and cgi are enabled

sudo a2enmod rewrite cgi
 
Restart Apache to take effect

sudo systemctl restart apache2

Setup the database for Koha

sudo koha-create --create-db library


Add new 8080 port (for IP based install) to Apache

sudo vim /etc/apache2/ports.conf

( need to add Listen 8080 below Listen 80 )

Enable Virtual-host on Apache

sudo a2dissite 000-default && sudo a2enmod deflate && sudo a2ensite library && sudo systemctl restart apache2


Test to ensure everything is working

In the web browser, visit http://localhost or http://127.0.0.1 {Koha maintenance message}
In the web browser, visit localhost:8080 or 127.0.0.1:8080 It will prompt for username & password

username --> koha_library
password --> get it executing below command –>

sudo koha-passwd library


Follow onscreen instructions/wizard create a library and a super librarian

Change Koha Master Password (optional)

Koha master password can be changed by editing the koha-conf.xml file

sudo sed -i 's/1MvFLNny4naCWmo@/kohalib/g' /etc/koha/sites/library/koha-conf.xml 

(for single click changing password, use this command)

OR  manually change

sudo vim /etc/koha/sites/library/koha-conf.xml

Under config, section find out the line password and change it

<config>
 <db_scheme>mysql</db_scheme>
 <database>koha_library</database>
 <hostname>localhost</hostname>
 <port>3306</port>
 <user>koha_library</user>
 <pass>1MvFLNny4naCWmo@</pass> 

( change default password 1MvFLNny4naCWmo@ to kohalib ) save it

then change MySQL privileges

sudo mysql -uroot -p 

[enter the MySQL Root password]

use mysql;
SET PASSWORD FOR 'koha_library'@'localhost' = PASSWORD('kohalib');
flush privileges;
quit;

Restart Memcached Apache2 and MySQL 

sudo systemctl restart memcached apache2 mysql

Enable Plack with Koha and Improve the Performance

sudo a2enmod headers proxy_http && sudo systemctl restart apache2 && sudo koha-plack --enable library && sudo koha-plack --start  library

Restart server

sudo reboot


Resources: 
Ubuntu: wiki.koha-community.org/wiki/Koha_on_ubuntu_packages

17 comments:

  1. Is that 20.05 version of koha?. If so, go to Tools-->News. opac header and opacmainuserblock have been shifted to news module in the latest koha version

    ReplyDelete
  2. unable to get login page on port 8080
    and port 80 showing maintenance page
    using ubuntu 20 latest
    mysql 8

    ReplyDelete
  3. I read this article. I think You put a lot of effort to create this article. I appreciate your work. https://freshapps.com/page/349/

    ReplyDelete
  4. Even after executing the command to install the pearl modules and actually installing them, I am still getting the error about pearl modules

    ReplyDelete
  5. Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. sportlifeonline.net/nhlstreams/

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. i tried the steps on AWS AMI ver16/v18 and v20...and also refer to the steps at
    https://wiki.koha-community.org/wiki/Koha_on_ubuntu_-_packages
    ..all return same error. Some important steps is missing. If you can point me to any forum/bugsfix page to solve this issue please.


    The following packages have unmet dependencies:
    koha-common : Depends: libmojolicious-plugin-openapi-perl but it is not going to be installed
    Depends: libnet-oauth2-authorizationserver-perl but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

    ReplyDelete
  8. Successfully installed Vufind 7.x (Solr Search Engine) with Koha 20.x in Ubuntu 20.x

    visit https://kohalibrary.in/

    ReplyDelete
  9. Hi bro,
    I appreciate your work.
    Would you lease find a solution to this error?
    root@DESKTOP-FCE765O:/home/kiki# sudo a2ensite library
    ERROR: Site library does not exist!
    Thanks

    ReplyDelete
  10. After deleting borrower i cant login by my admin account

    ReplyDelete
  11. very Good article. But if you need OJS Installation, just visit our website http://sch.com.pk for service by experts.

    ReplyDelete
  12. XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
    _XSERVTransMakeAllCOTSServerListeners: server already running
    (EE)
    Fatal server error:
    (EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
    (EE)
    Please consult the The X.Org Foundation support
    at http://wiki.x.org
    for help.
    (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
    (EE)
    (EE) Server terminated with error (1). Closing log file.
    this error occured while entering the command create db

    ReplyDelete