During my training sessions, blogs, social media online chat I have received a large number of request regarding how to upgrade the old koha database to a new one. This tutorial will also help regarding the backup, restoration and zebra index rebuild etc during day today routine work. Let me also explain that you can also use PhpMyAdmin for export or backup MySQl database. PhpMyAdmin is a good tool for databases backup but if the database size is very big it probably won’t be a good idea. The best and recommended method for bakup and dta export is MySQL database is by doing the work locally on the server/machine. In this method the data can be instantly dumped on the local disk easily and the export speed will be faster and will reduce the time MySQL database.
Let’s assume that you are running a koha ILMS in your computer and you need to upgrade, or you wish to change the computer machine or you need to upgrade the existing koha database to the new version of koha this help file will guide you the whole processing of migrations from existing system to the new system.
The very first step is to take the backup of your old system which is currently used for Koha ILMS in your organizations. For this purpose you need to execute the following important command in LINUX terminal. (Please note that this method is for the Linux version koha not for the Window version). Now please follow the following method in terminal in your computer system:
- 1st you need to open the terminal in your system
- After that login as root users “SU”
- Apply the following command in your terminal
- mysqldump -u root -p koha_library > koha_library_old.sql
- -u specifies the user to log in to MySQL as, in this case kohaadmin
- -p makes mysqldump prompt for the password
- koha is the name of the database
The system will asked for the MySQl password apply the same
- After executing the above methods save in pin drive or email your dump database backup
In the 1st step you have successfully take the backup of your existing system database. There is two type of question someone needs to upgrade the existing database within existing server/machine OR someone needs to change the server/machine and import the other old system database to the new server/computer/machine. For those who want to upgrade the existing koha database with existing server/computer/machine they may apply the 1st methods and after that apply the following command for upgrading the existing koha database:
- Open the terminal and apply the following command
- sudo su (it will required the password please enter your password)
- apt-get update
- apt-get upgrade
- apt-get install koha-common
(Note you can apply the above command after importing the old database to the new installed system too)
After executing the above command on terminal your old koha database will be upgraded to the next stable koha version.
- Now the next step is common for both types of users either thy change the server/computer/machine or they want to import on the existing server/computer/machine. This method is how to import your old database to the new database. Please follow the following steps for importing the old database:
- 1st open a terminal and login as root users
- You need to create a new koha instance library. But If you have already koha in your system then simply crate another instance using the following command.
- sudo koha-create –create-db library( Where library is the new of the new koha instance)
- Now the next step is for those who need to change the server/computer and import your old system database to the new server/computer. For this you need to remove the database which was created in the new installation on new server/computer. Please apply the following methods step by step;
Login to MySql by appliying the following command i.e
mysql -u root -p
The systems will ask the password pelase enter the password.
- Now the next process you have to drop the current database, and recreate a new one by executing the following command
- drop database koha_library;
create database koha_library;
- and next write “ quiet;” and exist from the system
- Now the next process is to restore the old database backup to the new system/computer etc. Please follow the following process in order to restore your dump command in to the new system:
- mysql -u root -p koha_library < koha_library.sql
- Where “root” is the root/admin MySQL user
- “koha_library” is the name of the database of your new Koha instance in new computer/machine/server
- “koha_library_old.sql” is the database backup from your old Koha instance on computer/machine/server
- The system will ask the MySQL password enter the password.
- After executing the above command your old database backup is now migrated to the new system/computer/server etc. After that process you need to upgrade the database schema by applying the following command:
- sudo su
- koha-upgrade-schema library
After executing these commands your new koha schema will be upgraded to the new database schema.
- After applying the above methods now your new system database is up to date and you successfully import the old dump database backup to the newly installed server/computer or to the existing koha database. Now we almost have done the required work and need just to rebuild the zebra index. For this you need again to execute the the zebra rebuild command. Please note that the zebra rebuild command is very important in the whole process. The zebra rebuild index is also very important if you need did a huge migrations/import a large scale data in to the koha database etc. Please apply the following command:
- sudo koha-rebuild-zebra -v -f library
- After applying the zebra rebuild command your system will up to date and your old database will successfully migrated to the newly installed system.
Sher Afzal Khan is currently working as Chief Librarian Bahria Town Pvt Ltd. He is also approved trainer of Higher Education Commission Pakistan of Koha and Dspace and organized different workshop at Islamabad and Lahore through HEC platform. He also organized a large number of workshops (More than 57) for librarian in prestigious organization in Pakistan. He is also a Country ambassador of Dspace Institutional Repository for Pakistan. Hs successfully implement koha ILS in more than 25 prestigious organizations i.e. Bahria University Libraries, Pakistan Institute of parliamentary Services (PIPS), Agriculture University Peshawar, Higher Education Commission Library Islamabad, Sindh Madras -tul-Islam University, Lawrence College Murfree, Pakistan Ordinance Factory Wah (POF) and many others. He also help different organization while implanting koha in different organization i.e NUST, GCU, University of Peshawar, Islamia College Peshawar, University of Karachi Central Library, and many other prestigious organization of Pakistan. His expertises include Linux, Peon Source Software, Dspace Koha, data migration, and word press software’s. He also developed a custom live DVD (LIBSOL) for Koha and Dspace software for those who wish to implement koha and Dsapce in their respective organization. He tweets@SherAfzal2000 he may also be contacted at (email@example.com firstname.lastname@example.org
Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something. I think that you can do with some pics to drive the message home a bit, but instead of that, this is wonderful blog. A great read. I’ll definitely be back.