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
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
- Update Debian:
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.
- Run the command:
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
- Add the repository to your sources list:
Install Koha and dependencies:
- Run the installation command:
sudo apt install -y koha-common(This may take a few minutes).
- Run the installation command:
Configure Koha:
- Edit the initial configuration file:
sudo vim /etc/koha/koha-sites.conf - Set the
INTRAPORTto 8080,OPACPORTto 80, and configure the domain and Memcached settings as needed.
- Edit the initial configuration file:
Enable necessary Apache modules:
- Enable rewrite and CGI modules:
sudo a2enmod rewrite cgi - Restart Apache:
sudo systemctl restart apache2
- Enable rewrite and CGI modules:
Create the Koha database:
- Run the database creation command:
sudo koha-create --create-db library
- Run the database creation command:
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
- Add port 8080 to Apache:
Test Koha:
- Visit
http://127.0.0.1in a web browser (you should see a maintenance message). - Visit
http://127.0.0.1:8080and log in with the username “koha_library” and the password obtained from runningsudo koha-passwd library. - Follow the on-screen instructions to finalize the Koha setup.
- Visit
Optional Configurations
Change the Koha Master Password: Edit the
koha-conf.xmlfile (sudo vim /etc/koha/sites/library/koha-conf.xml) and locate the “password” line under the “config” section to change it. Alternatively, use the commandsudo sed -i 's/1MvFLNny4naCWmo@/kohalib/g' /etc/koha/sites/library/koha-conf.xmlto 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 5sudo 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:
- Enable necessary modules:
sudo a2enmod headers proxy_http && sudo systemctl restart apache2 - 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.
