Friday, October 17, 2025

Koha Command Line Installation on Ubuntu 24.04

 

Step-by-Step Koha Installation on Ubuntu

This process requires administrative access (sudo) and uses the terminal for all steps.

Phase 1: Preparation and Package Installation

StepCommandDescription
1. Update Systemsudo apt update sudo apt upgradeEnsure your Ubuntu server is running the latest packages.
2. Add Koha Repository Key`wget -O- https://debian.koha-community.org/koha/gpg.ascsudo apt-key add -`
3. Add Koha Repository`echo 'deb http://debian.koha-community.org/koha stable main'sudo tee /etc/apt/sources.list.d/koha.list`
4. Re-update Package Listsudo apt updateFetches the package information from the newly added Koha repository.
5. Install Core Dependenciessudo apt install mariadb-server apache2Installs the MariaDB database server and the Apache web server, which are prerequisites for Koha.
6. Install Koha Softwaresudo apt install koha-commonInstalls the main Koha application and its required dependencies.
Phase 2: Configuration and Instance Creation

StepCommandDescription
7. Enable Apache Modulessudo a2enmod rewrite cgi sudo systemctl restart apache2Enables the required Apache modules and restarts the web server.
8. Create Koha Instancesudo koha-create --create-db mylibraryCreates a new Koha instance named mylibrary. This automatically sets up a database (koha_mylibrary) and a configuration file. (Replace mylibrary with your desired instance name).
9. Configure Ports (Optional but Recommended)sudo nano /etc/apache2/ports.confOpen the Apache port configuration file. Add Listen 8080 below Listen 80 to ensure the Staff Client can use this port.
10. Enable Koha Sitesudo a2dissite 000-default sudo a2ensite mylibrary sudo service apache2 restartDisables the default Apache welcome page, enables the new mylibrary Koha configuration, and restarts Apache to apply changes.
11. Retrieve Passwordsudo xmlstarlet sel -t -v 'yazgfs/config/pass' /etc/koha/sites/mylibrary/koha-conf.xml ; echoExecutes a command to print the randomly generated database password for your instance. Copy and save this password.
12. Restart Servicessudo service memcached restartRestarts the caching service, which is often necessary before accessing the web installer.

Installing Koha on Ubuntu involves a series of steps executed in the terminal, as the recommended method is using the Koha Community Debian Packages. This approach ensures you get a stable, well-maintained version of the software.

Here is a step-by-step guide on how to install Koha on an Ubuntu server (or desktop):


⚙️ Step-by-Step Koha Installation on Ubuntu

This process requires administrative access (sudo) and uses the terminal for all steps.1

Phase 1: Preparation and Package Installation

StepCommandDescription
1. Update Systemsudo apt update sudo apt upgradeEnsure your Ubuntu server is running the latest packages.
2. Add Koha Repository Key`wget -O- https://debian.koha-community.org/koha/gpg.ascsudo apt-key add -`
3. Add Koha Repository`echo 'deb http://debian.koha-community.org/koha stable main'sudo tee /etc/apt/sources.list.d/koha.list`
4. Re-update Package Listsudo apt updateFetches the package information from the newly added Koha repository.
5. Install Core Dependenciessudo apt install mariadb-server apache2Installs the MariaDB database server and the Apache web server, which are prerequisites for Koha.
6. Install Koha Softwaresudo apt install koha-commonInstalls the main Koha application and its required dependencies.

Phase 2: Configuration and Instance Creation

StepCommandDescription
7. Enable Apache Modulessudo a2enmod rewrite cgi sudo systemctl restart apache2Enables the required Apache modules and restarts the web server.
8. Create Koha Instancesudo koha-create --create-db mylibraryCreates a new Koha instance named mylibrary. This automatically sets up a database (koha_mylibrary) and a configuration file. (Replace mylibrary with your desired instance name).
9. Configure Ports (Optional but Recommended)sudo nano /etc/apache2/ports.confOpen the Apache port configuration file. Add Listen 8000 below Listen 80 to ensure the Staff Client can use this port.
10. Enable Koha Sitesudo a2dissite 000-default sudo a2ensite mylibrary sudo service apache2 restartDisables the default Apache welcome page, enables the new mylibrary Koha configuration, and restarts Apache to apply changes.
11. Retrieve Passwordsudo xmlstarlet sel -t -v 'yazgfs/config/pass' /etc/koha/sites/mylibrary/koha-conf.xml ; echoExecutes a command to print the randomly generated database password for your instance. Copy and save this password.
12. Restart Servicessudo service memcached restartRestarts the caching service, which is often necessary before accessing the web installer.

Phase 3: Web Installer Setup

  1. Open your browser and navigate to the Staff Client URL:

    • http://127.0.0.1:8000 (If installing on the same machine)

    • http://[Your Server IP Address]:8000 (If accessing remotely)2

  2. The Koha web installer will open.3 You will be prompted to log in using:

    • Username: koha_mylibrary (Your instance name prefixed with koha_)4

    • Password: The random password you retrieved in Step 11.

  3. Follow the on-screen prompts to complete the final steps:

    • Select your MARC flavor (e.g., MARC21).5

    • Import necessary data (sample patrons, item types).

    • Create your first Super Librarian account.6

Once these steps are complete, your Koha installation is finished and ready for use.

KIM Library OPAC