Everybody is familiar with using Google Drive. Google Drive is the cloud storage service of Google Inc. Currently, 15 GB of free storage is available with a Google account. Koha users can make use of Google Drive storage to keep database backups. GNOME desktop facilitates synchronising online accounts like Google, Nextcloud, Facebook, Microsoft, Flickr, etc.
Showing posts with label backup. Show all posts
Showing posts with label backup. Show all posts
pCloud for Koha backup
pCloud is a cloud storage service that offers a secure and convenient way to store, share, and access your files from anywhere. It works like Dropbox cloud storage. Dropbox gives only 2 GB of free storage only. pCloud provides a variety of pricing plans, starting with a free plan that gives you 10 GB of storage. Koha users can make use pCloud for backup storage. Schedule the backup and point to the PCloud storage is very convenient.
Backup with auto delete old files
Here is a shell script to schedule the backup with a time stamp. It keeps three days of backup and deletes previous files to save space. This method is convenient for working with cloud storage with limited space (e.g. Dropbox).
Follow the instructions below to schedule the backup.
Download the shell script
Copy the shell script to the home folder. Open the shell script and make changes to the Koha database, username, password and location of the backup. The timestamp of the database also appears on the backup file name. Give the number of days the backup keeps.
Move the shell script to /usr/local/bin
sudo cp backup.sh /usr/local/bin
Give the necessary permission to the shell script,
cd /usr/local/bin
sudo chmod +x backup.sh
sudo chown "$USER:$USER" backup.sh
sudo chmod 700 backup.sh
Create the cron job entry for the backup. Apply the following command on the terminal.
export EDITOR=mousepad
crontab -e
Copy the lines below to the bottom part of the crontab file.
#Koha backup
10 20 * * * /usr/local/bin/backup.sh
Change the timing of the backup. Here, backup takes at 8:10 PM.
Backup with time stamp and automatic deletion of old files
Scheduling Koha backup can save the time of the library staff. Know the backup date and time from the filename (e.g. koha_library-25-04-2017-20.08.sql.gz) is very convenient. Entry to delete old files remove backup files older than stated days (e.g. 5 days) and avoid the heap of files in the computer/cloud storage.
Cron is a utility available in Linux Operating system, which helpful to schedule various tasks (e.g. Backup Koha database in a particular time). User has to record the desired tasks in Crontab file with time to execute.
Synchronize and store Koha backup in Dropbox
Dropbox is an online storage service and it offers 2 GB free storage space. "Dropbox allows users to create a special folder on their computers, which Dropbox then synchronizes so that it appears to be the same folder (with the same contents) regardless of which device is used to view it. Files placed in this folder are also accessible via the Dropbox website and mobile apps". It is very convenient to store Koha database backup in Dropbox cloud storage. No need to copy the Koha database in pen drive every day.
Install Dropbox client
Create Dropbox account.
Ubuntu users can install the package using the command;
Ubuntu users can install the package using the command;
sudo apt-get install nautilus-dropbox
After the installation of the package, open the client from
Applications > Internet > Dropbox
Applications > Internet > Dropbox
Sign in the Dropbox account after finishing the installation.
Move old Koha database to new installation
1. Backup of old Koha
Take the backup of your existing Koha database. Either you can make use a database kept in your pen drive otherwise you can apply following command to take the backup,
sudo mysqldump -uroot -p koha_library | xz > koha_library.sql.xz
Put MySQL root password, when it asks.
2. Install Koha
Follow the instructions in Koha wiki
Take the backup of your existing Koha database. Either you can make use a database kept in your pen drive otherwise you can apply following command to take the backup,
sudo mysqldump -uroot -p koha_library | xz > koha_library.sql.xz
Put MySQL root password, when it asks.
2. Install Koha
Follow the instructions in Koha wiki
3. Restoration of old Koha database to a new one
Remove the existing database in the new Koha installation
sudo mysql -uroot -p
[Enter the Linux password and after that enter MySQL Root password]
drop database koha_library;
create database koha_library;
quit;
Copy your database backup from your pen drive to home folder.
Extract the backup file, the extension will be .sql
Then restore the old backup to the new Koha installation.
Database Restoration commands,
sudo mysql -uroot -p koha_library < koha_library.sql
Database Restoration commands,
sudo mysql -uroot -p koha_library < koha_library.sql
[Check name of your source Koha database]
exit
koha_library - name of database in new installation
koha_library - name of database in new installation
koha.sql - name of database in old installation
Enter the MySQL root password.
4. Upgrade Database Schema
Database schema of old Koha should upgrade to match with the new version. Apply following commands in a terminal one by one,
sudo service memcached restart
sudo koha-upgrade-schema library
sudo koha-upgrade-schema library
5. Rebuild the Zebra Index.
Apply following command in a terminal,
sudo koha-rebuild-zebra -v -f library
How to schedule database backup in Koha
You can enable schedule backup of koha database with the help of cron job feature in Ubuntu. Cron is a system daemon used to execute desired tasks (in the background) at designated times.You can read more about cron in Ubuntu here.
In this process we put a mysql command to take backup of Koha database in every 60 minutes.
Create a folder in home folder called "backup", where backup file store.
Open Applications > Accessories > Terminal
Apply the following command,
crontab -e
It will ask to select a text editor. You can select Nano text editor.
You can see crontab file content. Use down arrow button and move the cursor to bottom part of the cron file. Copy following command there.
*/60 * * * * mysqldump -ukoha_library -pkoha123 koha_library | xz > /home/koha/backup/koha_library.sql.xz
Run backup command in a specific time
15 16 * * * mysqldump -ukoha_library -pkoha123 koha_library | xz > /home/koha/backup/koha_library.sql.xz
Above mentioned command take a backup at 3:15 PM every day.
Apply Ctrl + o button to save the file.
Then apply Ctrl + x to leave the cron.
You can find backup file in /home/koha/backup folder after 60 minutes.
Explanations of key parts in the command,
-u koha_library = MySQL Koha Database username
-p koha123 = password of Koha Database
koha_library = Koha database name
XZ = compression format.
In this process we put a mysql command to take backup of Koha database in every 60 minutes.
Create a folder in home folder called "backup", where backup file store.
Open Applications > Accessories > Terminal
Apply the following command,
crontab -e
It will ask to select a text editor. You can select Nano text editor.
You can see crontab file content. Use down arrow button and move the cursor to bottom part of the cron file. Copy following command there.
*/60 * * * * mysqldump -ukoha_library -pkoha123 koha_library | xz > /home/koha/backup/koha_library.sql.xz
Run backup command in a specific time
15 16 * * * mysqldump -ukoha_library -pkoha123 koha_library | xz > /home/koha/backup/koha_library.sql.xz
Above mentioned command take a backup at 3:15 PM every day.
Apply Ctrl + o button to save the file.
Then apply Ctrl + x to leave the cron.
You can find backup file in /home/koha/backup folder after 60 minutes.
Explanations of key parts in the command,
-u koha_library = MySQL Koha Database username
-p koha123 = password of Koha Database
koha_library = Koha database name
XZ = compression format.
Subscribe to:
Posts (Atom)





