How to set up Koha on a Debian system

Koha is officially compatible with Debian GNU/Linux. To install, download the stable Debian GNU/Linux ISO file from the provided link and install it via a network connection. During installation, select your preferred desktop environment (XFCE is recommended for speed).

Installing Debian

For users unfamiliar with the Debian installation process, a helpful video tutorial is linked in the original text.

Setting Up Koha

  1. Open the Terminal (Applications > System Tools > Terminal) and run the following commands:

    • Update Debian: sudo apt update && sudo apt upgrade -y
    • Install LAMP and other necessary packages: sudo apt install -y software-properties-common dirmngr file-roller unzip wget gnupg2 git curl vim tmux apache2 mariadb-server php libapache2-mod-php php-{bcmath,bz2,intl,gd,mbstring,mysql,zip,cli,fpm,opcache,xml,curl,intl,xsl,soap,json,apcu,imap,xmlrpc}
    • Clear package manager cache: sudo apt clean
  2. Secure MariaDB:

    • Run the command: sudo mysql_secure_installation
    • Follow the prompts to enhance security by setting the root password, removing the anonymous user, restricting root access, and removing the test database. Respond “yes” to all prompts.
  3. Add the Koha repository:

    • Add the repository to your sources list: 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' (Replace “oldstable” with “stable” for the latest version).
    • Add the trusted key: sudo sh -c 'wget -qO - https://debian.koha-community.org/koha/gpg.asc | gpg --dearmor -o /usr/share/keyrings/koha-keyring.gpg'
    • Update your repository list: sudo apt update
  4. Install Koha and dependencies:

    • Run the installation command: sudo apt install -y koha-common (This may take a few minutes).
  5. Configure Koha:

    • Edit the initial configuration file: sudo vim /etc/koha/koha-sites.conf
    • Set the INTRAPORT to 8080, OPACPORT to 80, and configure the domain and Memcached settings as needed.
  6. Enable necessary Apache modules:

    • Enable rewrite and CGI modules: sudo a2enmod rewrite cgi
    • Restart Apache: sudo systemctl restart apache2
  7. Create the Koha database:

    • Run the database creation command: sudo koha-create --create-db library
  8. Configure Apache for Koha access:

    • Add port 8080 to Apache: sudo vim /etc/apache2/ports.conf (Add “Listen 8080” below “Listen 80”).
    • Enable the Koha virtual host: sudo a2dissite 000-default && sudo a2enmod deflate && sudo a2ensite library && sudo systemctl restart apache2
  9. Test Koha:

    • Visit http://127.0.0.1 in a web browser (you should see a maintenance message).
    • Visit http://127.0.0.1:8080 and log in with the username “koha_library” and the password obtained from running sudo koha-passwd library.
    • Follow the on-screen instructions to finalize the Koha setup.

Optional Configurations

  • Change the Koha Master Password: Edit the koha-conf.xml file (sudo vim /etc/koha/sites/library/koha-conf.xml) and locate the “password” line under the “config” section to change it. Alternatively, use the command sudo sed -i 's/1MvFLNny4naCWmo@/kohalib/g' /etc/koha/sites/library/koha-conf.xml to quickly change the default password to “kohalib.”

  • Modify MariaDB Privileges: Run the following commands to change the MariaDB privileges, replacing placeholders with the actual passwords:

    1
    2
    3
    4
    5
    
    sudo mariadb -uroot -p
    use mysql;
    SET PASSWORD FOR 'koha_library'@'localhost' = PASSWORD('new_password');
    flush privileges;
    quit;
    
  • Restart Services: After making changes, restart Memcached, Apache2, and MariaDB: sudo systemctl restart memcached apache2 mysql

Enhance Performance with Plack

Enable Plack to improve Koha performance:

  1. Enable necessary modules: sudo a2enmod headers proxy_http && sudo systemctl restart apache2
  2. Enable and start Plack: sudo koha-plack --enable library && sudo koha-plack --start library

Finally, reboot your server: sudo reboot

This guide provides a simplified approach to installing Koha on Debian. For comprehensive instructions, refer to the official Koha documentation linked in the original text.

Licensed under CC BY-NC-SA 4.0
Last updated on Nov 08, 2022 15:51 +0100