Koha Database to a New Server

Koha Database to a New Server

Migrating your Koha Integrated Library System (ILS) from one server to another might sound like a tech-heavy process, but with the right steps, it’s surprisingly manageable. Whether you’re upgrading your hardware or installing a newer version of Koha, this guide walks you through the full migration — from backing up to restoring and upgrading your database.

Step 1: Backup the Old Koha Database

Start by creating a compressed backup of your existing Koha database. Run this command on the current server:

sudo mysqldump -uroot -p koha_library | xz > koha_library.sql.xz

When prompted, enter your MySQL root password. The .xz file contains your entire library database and can be transferred using a USB or cloud storage.

Step 2: Install Koha on the New Server

Set up a fresh Koha installation on your new server. Follow the official instructions provided on the Koha Wiki. Make sure the base instance is up and running before proceeding to the next step.

Step 3: Restore the Old Database

After installing Koha:

  1. Log in to MySQL: bashCopyEditsudo mysql -uroot -p
  2. Remove the new database and create a blank one: sqlCopyEditdrop database koha_library; create database koha_library; quit;
  3. Move your backup file to your home folder and extract it: bashCopyEditunxz koha_library.sql.xz
  4. Restore the data: bashCopyEditsudo mysql -uroot -p koha_library < koha_library.sql

Make sure your database name matches the one used during Koha installation.

Step 4: Upgrade Database Schema

Once your data is restored, you need to align the database schema with the new version of Koha. Run the following commands:

sudo service memcached restart
sudo koha-upgrade-schema library

Replace library with your actual Koha instance name.

Step 5: Rebuild Zebra Index

To enable searching and catalog access, rebuild the Zebra index using:

sudo koha-rebuild-zebra -v -f library

This command ensures that all bibliographic records are correctly indexed in your new system.

Final Thoughts

That’s it! You’ve successfully migrated your Koha database to a new installation. With proper backups, careful restoration, and a few terminal commands, you can get your library system up and running smoothly on a new server. This process helps preserve all your valuable data while taking advantage of updated software or hardware.

editor

Related Articles