Koha Solutions

Installation guide

Koha Installation on Ubuntu 24.04 LTS — A Complete Step-by-Step Guide

Every command, from the community repository to a catalog that can lend a book — including the twelve steps most guides stop before.

A terminal installing Koha on Ubuntu

Updated August 2026 · Tested against Koha 25.11 · Ubuntu 24.04 LTS

Installing the Koha package takes an afternoon. Opening a library takes longer, and the difference is everything below step 8 — the email records, the notice templates, the scheduled jobs and a backup you have actually restored. This guide covers both halves, in order, with the commands.

Before you start

Four things, and the last one is the one people redo Apache for.

  1. 1A server. Under about 20,000 items runs comfortably on 2 vCPU and 4 GB of RAM. A large or multi-branch library wants 4+ vCPU and 8–16 GB, more with Elasticsearch. Concurrent users decide this, not catalog size.
  2. 2A current Ubuntu LTS or Debian stable, with sudo.
  3. 3A UTF-8 locale. Koha requires one, and a mismatch produces character corruption in records that is miserable to unpick after cataloging has started.
  4. 4Two hostnames, decided now — one for the public catalog, one for staff. They go into the config before the instance is created, and changing your mind afterwards means reconfiguring Apache.
Two hostnames on one Koha server — public catalog on port 80/443, staff interface on port 8080

Step 1Prepare the server

Terminal
sudo apt update && sudo apt -y upgradesudo apt -y install wget gnupg lsb-release apt-transport-https ca-certificatessudo timedatectl set-timezone Etc/UTC

Set the timezone to your own — it decides when overdue notices are calculated and when the scheduled jobs run, so a wrong one is a support ticket six weeks later.

Step 2Add the Koha community repository

Use the community repository, not a distribution package — it is the one that is actually current.

Terminal
wget -qO- https://debian.koha-community.org/koha/gpg.asc \    | sudo gpg --dearmor -o /usr/share/keyrings/koha-keyring.gpgecho "deb [signed-by=/usr/share/keyrings/koha-keyring.gpg] \https://debian.koha-community.org/koha stable main" \    | sudo tee /etc/apt/sources.list.d/koha.listsudo apt update

stable tracks the current stable series. Replace it with a release number (25.05) when a version has to be held.

Check this line before running it on a production box

The repository line is the part that changes between Koha releases. Verify it against the Koha wiki for the release you are installing. A guide that does not tell you this is a guide that will be wrong within a year — including this one, if we stop maintaining it.

Step 3Install the database server

Terminal
sudo apt -y install mariadb-serversudo mysql_secure_installation

Do not create a database or user by hand. koha-create makes its own in step 7, and a hand-made one is a mismatch waiting to happen.

Step 4Install Koha

Terminal
sudo apt -y install koha-common

This pulls in Apache, the Perl stack and the search indexer. It does not create a library yet — which is the step people believe they have already done.

You are on step 4 of 16

Everything from here to step 15 is already done on Koha Cloud — the server, HTTPS, Apache, the scheduled jobs, SMTP with its DNS records, Z39.50 targets and tested backups are configured before you log in.

See Koha Cloud

Step 5Configure koha-sites.conf

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

The file documents its own URL formula, and it is worth reading before editing:

How the URLs are built
OPAC:  http://<OPACPREFIX><instance><OPACSUFFIX><DOMAIN>:<OPACPORT>STAFF: http://<INTRAPREFIX><instance><INTRASUFFIX><DOMAIN>:<INTRAPORT>

Set DOMAIN to your own, INTRAPORT to 8080 and OPACPORT to 80. The shipped defaults include INTRASUFFIX="-intra", ZEBRA_MARC_FORMAT="marc21", ZEBRA_LANGUAGE="en" and memcached enabled.

Step 6Enable the Apache modules and port

Terminal
sudo a2enmod rewrite cgi headers proxy_httpgrep -q '^Listen 8080' /etc/apache2/ports.conf \    || echo "Listen 8080" | sudo tee -a /etc/apache2/ports.confsudo systemctl restart apache2

The package ships its own Listen 8080, so the second command is usually a no-op — it is there because the one server where it is not is the one where the staff interface silently refuses to load.

Step 7Create the instance

Terminal
sudo koha-create --create-db --marcflavor marc21 --zebralang en library

The flag is --marcflavor, US spelling

Verified in debian/scripts/koha-create in the Koha source. Several popular guides write --marcflavour, and it fails.

MARC21 or UNIMARC is permanent

It cannot be changed after the instance is created. MARC21 is the right answer for most of the world and is what most copy-cataloging targets return; UNIMARC is used in parts of Europe and elsewhere. Decide deliberately.

The instance name becomes database names, system users and file paths. Renaming it later is not practical, so pick something short and permanent — library rather than test2.

Flags worth knowing about now rather than later: --elasticsearch-server, --enable-sru, --letsencrypt, --smtp-host, --timezone and --defaultsql.

Step 8Enable the site and start Plack

Terminal
sudo a2dissite 000-defaultsudo a2ensite librarysudo koha-plack --enable librarysudo koha-plack --start librarysudo systemctl reload apache2

Step 9Get the password and run the web installer

Terminal
sudo koha-passwd library

Open the staff hostname on port 8080 and log in with that password. The installer then walks through schema creation and onboarding.

  1. 1Confirm the database connection and create the schema.
  2. 2Choose your MARC flavour — the same permanent choice as step 7.
  3. 3Create the library, then the superlibrarian account you will actually use.
  4. 4Add item types, patron categories and at least one circulation rule.

At this point Koha runs. It cannot yet send a notice, import a record from another catalog, charge a fine or survive a disk failure — which is what the rest of this guide is for.

Step 10HTTPS and the firewall

Terminal
sudo apt -y install certbot python3-certbot-apachesudo certbot --apache -d library.example.org -d library-intra.example.orgsudo ufw allow 80,443/tcpsudo ufw enable

A staff login over plain HTTP is a credential leak. The staff interface also does not need to be reachable from the whole internet — restrict it to your institution's range if you can.

Step 11Scheduled jobs

The most-skipped step on this page and the most consequential. koha-common installs the schedule for you — including a job that processes the message queue for every enabled instance every fifteen minutes.

Terminal
koha-list --enabledsystemctl list-timers | grep -i kohals /etc/cron.d/koha-common /etc/cron.daily/koha-common

Nothing errors when these do not run

A number is simply always zero. Fines never accrue, overdue notices never send, the holds queue never builds — and you find out months later when a patron asks why they were never charged. Confirm the jobs exist before you go live, not after.

Step 12SMTP, so notices actually arrive

Koha 22.11 and later has Administration → SMTP servers in the staff interface; older versions edit koha-conf.xml. That is the easy half.

The half that gets marked done too early is DNS on your sending domain:

  1. 1SPF — which servers may send as your domain.
  2. 2DKIM — a signature proving the message was not altered.
  3. 3DMARC — what a receiver should do when the first two fail.
  4. 4A test to an address outside your institution — and check the spam folder, not just that Koha reported success.

Without those records, overdue notices land in spam and staff conclude the system is broken. It is the single most common Koha complaint and it is a DNS problem, not a Koha problem.

Step 13Add Z39.50 and SRU targets

Without these, every record is typed by hand. With them a cataloger searches remote catalogs and imports a matching record in seconds — the difference between a week of cataloging and an afternoon.

The work is finding targets that are actually up and getting each one's connection and attribute settings right. A target with slightly wrong settings returns nothing at all rather than an error, which makes it tedious to debug and easy to give up on.

Step 14Backups you have actually restored

Terminal
sudo koha-dump librarysudo koha-dump --exclude-indexes library

koha-dump takes contents and configuration. --exclude-indexes produces a much smaller dump that is slower to restore, because Zebra has to rebuild.

A dump on the same server is not a backup

It dies with the disk. You need an automated dump, a copy somewhere else, a retention policy, and at least one restore you have actually performed — otherwise you have a file you hope is usable.

Step 15Verify everything is running

Terminal
systemctl status apache2 mariadbsudo koha-plack --status librarykoha-list --enabled

Then the checks a service restart cannot make for you: both URLs load over HTTPS, a test notice arrives at an external address, a Z39.50 search returns a record, and a checkout produces a due date.

Installing Koha on Windows

Koha is packaged for Debian and Ubuntu, and those packages are what the community supports. There is no supported native Windows installation.

You can run it under WSL2 or in a virtual machine, and that is genuinely fine for evaluating Koha on your own laptop. It is a poor idea for a library that depends on it: you inherit a second layer to patch and a backup story that is harder to test. If Windows is a hard institutional requirement, run Ubuntu on a small server instead — or use a hosted catalog and skip the question.

Troubleshooting

Seven failures that account for most of them.

What you seeWhat it usually is
Locale errors during installationNo UTF-8 locale generated. Generate and set one, then re-run — and fix it before cataloging, because a wrong locale corrupts records in a way that is painful to unpick later.
Apache will not start after enabling the siteAlmost always a port or ServerName collision with the default virtual host. Disable it with a2dissite 000-default.
Every staff page returns 404mod_rewrite is not enabled. a2enmod rewrite, then restart Apache.
The web installer cannot connect to the databaseThe password used is not the generated one for that instance. Read it with koha-passwd <instance> rather than guessing.
The OPAC loads blank or unstyledThe OPAC virtual host is serving the wrong document root, or Plack did not restart. koha-plack --restart <instance>.
Everything works until the server rebootsA service that was started by hand and never enabled. Check with systemctl is-enabled for each of apache2, mariadb and memcached.
Notices say “sent” but never arriveNot a Koha fault. Either the message queue job is not running, or the sending domain has no SPF/DKIM/DMARC records and the receiving server is filing them as spam.

Each of these has an article of its own, with the full diagnosis: koha-conf.xml cannot be located, the web installer 500s or times out, Apache will not start, apt cannot install koha-common, 502 after enabling Plack, and reading the error log that has the real message.

What “installed” does not mean

The package install is step 4 of 16. A library that can actually open needs the configuration, the email and its DNS records, the notice templates, the copy-cataloging targets, the scheduled jobs and a backup that has been restored at least once.

What a Koha package install leaves undone — email, scheduled jobs, Z39.50 targets and tested backups

Or skip all sixteen steps

Everything on this page is already done on Koha Cloud

You bring your data. The server, the certificates, the scheduled jobs, the mail records, the targets and the backups are already configured and already monitored.

On this pageOn Koha Cloud
SMTP plus SPF, DKIM and DMARC on your domainConfigured and deliverability-tested before handover
Z39.50 and SRU targets, found and tuned one by oneTargets configured, with copy cataloging working on day one
Scheduled jobs you have to confirm are runningRun for you, with a per-library record of every run
A backup you set up, copy offsite and restore yourselfAutomated, offsite, and you keep your own copy
Upgrades and security patches on your calendarOurs — your team never logs into a server
See Koha Cloud

Want it on your server instead? Koha installation services.

FAQ

Questions people ask mid-install

How long does installing Koha actually take?

Two to four hours to get the package installed, an instance created and the web installer finished — assuming nothing unusual about the server. That is not the same as a library that can open. Email with its DNS records, notice templates, Z39.50 targets, the scheduled jobs and a backup you have actually restored are the rest of the work, and they are what turn a few hours into a few weeks. The steps on this page are ordered so you can see which part you are in.

Can I install Koha on Windows?

Not directly. Koha is packaged for Debian and Ubuntu, and the official packages are what the community supports. On Windows you run it inside WSL2 or a virtual machine, which is genuinely fine for evaluating Koha on your own laptop and a poor idea for a library that depends on it — you inherit a second layer to keep patched and a backup story that is harder to test. If Windows is a hard requirement, run Ubuntu on a small server or use a hosted catalog instead.

MARC21 or UNIMARC — and can I change my mind later?

No, you cannot change it later, which is why it is worth a minute now. MARC21 is the right answer for most of the world and is what most copy-cataloging targets return. UNIMARC is used in parts of Europe and elsewhere; choose it only if your existing records are already in it or a national requirement says so. The flag is set once when the instance is created and everything after that assumes it.

What server do I need?

A small library — under about 20,000 items — runs comfortably on 2 vCPU and 4 GB of RAM. A large or multi-branch one wants 4 or more vCPU and 8 to 16 GB, and more if you add Elasticsearch. Disk is rarely the constraint until you start storing cover images and uploads. The number that actually decides it is concurrent staff and OPAC users, not the size of the catalog.

My notices are not sending. Is Koha broken?

Almost never. Two things have to be true and only one of them is inside Koha: an SMTP server it can reach, and a sending domain with SPF, DKIM and DMARC records that let your mail be accepted. Miss the DNS half and Koha reports the message as sent while the receiving server files it as spam. Check the message queue is being processed by the scheduled job, then send a test to an address outside your institution and look in the spam folder — not just at Koha telling you it worked.

Do I really need the scheduled jobs?

Yes, and they are the most-skipped step on this page. Fines accrual, overdue notices, the message queue, the holds queue and automatic renewals are all scheduled jobs — none of them is triggered by anything a librarian clicks. Miss one and nothing errors; a number is simply always zero, and you find out months later when a patron asks why they were never charged.

Can I install it myself now and move to hosting later?

Yes, and it is a common path — install it, run it for a year, then decide. Koha holds your data in a standard database and exports MARC and CSV, so moving is a migration rather than a rebuild. Doing the install yourself first is also the cheapest way to find out how much of your week the server wants.

What if I get stuck halfway through?

Most people get stuck in the same four places: Apache serving the wrong thing, the database password, email that reports success and arrives nowhere, and Z39.50 targets that return nothing without erroring. Each has its own section on this page. If the server is meant to be live on a date and it is not moving, that is what our installation service is for — we can pick up a half-finished install rather than starting again.