Skip to content

Instantly share code, notes, and snippets.

@jesussuarz
Created August 22, 2024 06:55
Show Gist options
  • Save jesussuarz/828a93d56be51034a9a41a4df5ca40e7 to your computer and use it in GitHub Desktop.
Save jesussuarz/828a93d56be51034a9a41a4df5ca40e7 to your computer and use it in GitHub Desktop.
Migration Guide for Koha 16.05 from Ubuntu 14.04.6 LTS to Ubuntu 22.04 LTS

Migration Guide for Koha 16.05 from Ubuntu 14.04.6 LTS to Ubuntu 22.04 LTS

This guide will help you migrate a Koha 16.05 instance from an older Ubuntu 14.04.6 LTS server to a new Ubuntu 22.04 LTS server. The instance will be named "koha16".

Prerequisites:

  1. Ensure you have a backup of your Koha database and configuration files.
  2. Verify the availability of all required dependencies and packages on the new server.
  3. Have root or sudo access on both the old and new servers.

Step 1: Prepare the Old Server

1. Backup the Database:

mysqldump -u root -p koha16 > /path/to/backup/koha16_backup.sql

2. Backup Configuration Files:

Copy the Koha configuration files to a safe location:

cp -r /etc/koha /path/to/backup/koha_config/

3. Stop Services:

Stop Koha and related services:

sudo systemctl stop apache2
sudo systemctl stop memcached
sudo systemctl stop koha-common

Step 2: Set Up the New Server (Ubuntu 22.04 LTS)

1. Update the System:

sudo apt update
sudo apt upgrade -y

2. Add Koha Repository:

Add the Koha repository for version 16.05:

echo "deb http://debian.koha-community.org/koha 16.05 main" | sudo tee /etc/apt/sources.list.d/koha.list
wget -q -O- http://debian.koha-community.org/koha/gpg.asc | sudo apt-key add -

3. Install Dependencies:

Install required packages, including specific versions of dependencies:

sudo apt update
sudo apt install fonts-dejavu-core fonts-dejavu-extra
wget http://archive.ubuntu.com/ubuntu/pool/universe/t/tinymce/tinymce_3.4.8+dfsg0-2_all.deb
sudo dpkg -i tinymce_3.4.8+dfsg0-2_all.deb

4. Install Koha 16.05:

sudo apt-get install koha-common=16.05.19-1

Step 3: Transfer Data to the New Server

1. Copy the Backup Files:

Transfer the database backup and configuration files to the new server using scp or a similar method:

scp /path/to/backup/koha16_backup.sql user@new-server:/path/to/destination/
scp -r /path/to/backup/koha_config/ user@new-server:/path/to/destination/

2. Restore the Database:

On the new server, restore the Koha database:

mysql -u root -p koha16 < /path/to/destination/koha16_backup.sql

3. Restore Configuration Files:

Move the configuration files to their appropriate locations:

sudo cp -r /path/to/destination/koha_config/ /etc/koha/
sudo chown -R koha-koha /etc/koha

Step 4: Configure Apache and SSL

1. Update Apache Configuration:

Adjust the koha.conf file for Apache to reflect the new server's configuration:

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

2. Ensure the ServerName is set to koha16.

sudo a2ensite koha.conf
sudo a2enmod rewrite ssl
sudo systemctl reload apache2

3. Set Up SSL:

If you need SSL, update the SSL configuration:

sudo nano /etc/apache2/sites-available/koha-ssl.conf

Replace the existing certificates with the Let's Encrypt certificates:

SSLCertificateFile /etc/letsencrypt/live/koha16.yourdomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/koha16.yourdomain.com/privkey.pem

4. Enable the SSL Site:

sudo a2ensite koha-ssl.conf
sudo systemctl reload apache2

Step 5: Finalize the Installation

1. Restart Services:

Restart Apache and Koha services:

sudo systemctl restart apache2
sudo systemctl restart koha-common

2. Verify Installation:

Test the Koha installation by accessing it via the web browser:

3. Rebuild Zebra Indexes:

koha-rebuild-zebra -v -f koha16

Troubleshooting and Validation

  • Log Files: Check the logs if you encounter any issues:
tail -f /var/log/koha/koha16/opac-error.log
tail -f /var/log/koha/koha16/intranet-error.log
  • Configuration Testing: Ensure Apache configuration is valid:
sudo apachectl configtest

This guide should cover the essential steps to successfully migrate your Koha 16.05 instance to a new server running Ubuntu 22.04 LTS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment