How to set up Koha on Ubuntu

Koha is the first open-source software designed for library management. It encompasses various functionalities such as acquisitions, cataloging, circulation, serial control, and an online public access catalog, along with numerous other advanced features. Koha’s adherence to international library standards ensures seamless compatibility with other library systems. It supports technologies like MARC 21, RFID, z39.50, and web 2.0. The software is highly customizable and includes all the essential modules found in standard library management systems.

Installing Koha: An Overview

  • Hardware Requirements (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). Other Debian/Ubuntu Linux distributions can also be used.
  • Apache: Webserver
  • MySQL/MariaDB: Relational Database
  • PERL: Programming language (including various Perl dependencies)

Installation Methods

  • From source/git
  • apt-get and pre-built packages (simplifies the installation)

Ubuntu Package Commands

Note: These commands have been tested on the latest Ubuntu LTS (20.04 Focal Fossa).

  1. Open Applications > System Tools > Terminal and execute the following commands one by one.

  2. Update Ubuntu using apt:

    sudo apt update && sudo apt upgrade -y

  3. Clear the apt-get package manager cache:

    sudo apt clean

  4. Install MariaDB-server dependency:

    sudo apt install -y mariadb-server

  5. Provide the MySQL/MariaDB root password. (If prompted during installation, enter the password. If not, use the following command to secure it):

    Securing MariaDB

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

    sudo mysql_secure_installation

    (The script will guide you through setting up the root user password, removing the anonymous user, restricting root user access to the local machine, and removing the test database. Finally, it will reload the privilege tables. Answer “Y” (yes) to all questions.)

  6. Add the Koha community repository. (Change “oldstable” to “stable” if you want the stable/latest version of Koha):

    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'

  7. Update the software repository:

    sudo apt update

  8. Install Koha and its dependencies:

    sudo apt install -y koha-common

    (This may take about 5 minutes with a reasonably fast internet connection.)

  9. Edit the initial configuration file:

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

    Edit INTRAPORT to 8080, OPACPORT to 80, domain, and Memcached settings (for the database) as needed.

  10. Ensure rewrite and cgi are enabled:

    sudo a2enmod rewrite cgi

    Restart Apache to apply the changes:

    sudo systemctl restart apache2

  11. Set up the database for Koha:

    sudo koha-create --create-db library

  12. Add a new port (8080) for IP-based installations to Apache:

    sudo vim /etc/apache2/ports.conf

    (Add Listen 8080 below Listen 80.)

  13. Enable Virtual Host on Apache:

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

  14. Test the installation:

    • Open a web browser and visit http://localhost or http://127.0.0.1. You should see the Koha maintenance message.

    • Visit localhost:8080 or 127.0.0.1:8080 in your web browser. You will be prompted for a username and password.

      • Username: koha_library
      • Password: Retrieve it by executing the following command:

      sudo koha-passwd library

    • Follow the on-screen instructions to create a library and a super librarian account.

Changing the Koha Master Password (Optional)

You can change the Koha master password by editing the koha-conf.xml file.

  1. Use the following command for a single-click password change:

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

    Alternatively, change it manually:

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

    Locate the “password” line under the “config” section and change the default password (1MvFLNny4naCWmo@ to kohalib) and save the file.

  2. Modify MySQL privileges:

    sudo mysql -uroot -p

    (Enter the MySQL root password when prompted.)

    1
    2
    3
    4
    
    use mysql;
    SET PASSWORD FOR 'koha_library'@'localhost' = PASSWORD('kohalib');
    flush privileges;
    quit;
    
  3. Restart Memcached, Apache2, and MySQL:

    sudo systemctl restart memcached apache2 mysql

Enable Plack with Koha to Enhance Performance

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

  2. Restart the server:

    sudo reboot

Resources

Licensed under CC BY-NC-SA 4.0
Last updated on Jul 06, 2024 14:32 +0100