Showing posts with label Koha. Show all posts
Showing posts with label Koha. Show all posts

Bulk marc import using command line

Bulk marc import using command line

Load environmental variables

sudo su
export PERL5LIB="/usr/share/koha/lib"
export KOHA_CONF="/etc/koha/sites/library/koha-conf.xml"


Move marc file to the folder where bulkmarcimport.pl is located.

e.g. Move a marc file from your home folder to following folder,

mv sample.mrc /usr/share/koha/bin/migration_tools

Go to the folder where import script located

cd /usr/share/koha/bin/migration_tools

Execute the following command,

perl bulkmarcimport.pl -file sample.mrc

User can import bibliographic records in a desired MARC Bibliographic Framework (e.g. BKS),

perl bulkmarcimport.pl -framework BKS -file sample.mrc

The following command will delete all existing records and install new batch of marc file.

perl bulkmarcimport.pl -d -file sample.mrc

Rebuild Zebra after import process finish

sudo koha-rebuild-zebra -f -v library

Information courtesy: Koha Users Group

Reference
https://perldoc.koha-community.org/misc/migration_tools/bulkmarcimport.html
http://kohageek.blogspot.com

 

In/Out Management

Steps for manual installation.

PHP Installation is required.

You can install PHP by executing following commands.

sudo apt-get install php -y

sudo apt-get install -y php-{bcmath,bz2,intl,gd,mbstring,mysql,zip}
 && sudo apt-get install libapache2-mod-php -y

How to download Package Files?

You can download the package from following link. And Copy them into Home directory.

Download Link : https://github.com/omkar2403/inout.git

Please rename the folder after extraction to inout. Now we have to copy the inout directory into ‘htdocs’ directory. Open the terminal into Home directory and apply the following commands.

sudo su
sudo mv /home/inout /usr/share/koha/opac/htdocs
cd /usr/share/koha/opac/htdocs
chmod 777 -R inout

Steps for quick database setup.

Open the terminal and apply the following commands.

sudo su
mysql -uroot -p
[Enter MySQL Root password]
create database lib;
grant all privileges on lib.* to 'root'@'localhost' identified by 'mysqlroot';
flush privileges;
Quit;

In above code ‘root’ is the username and ‘mysqlroot’ is the password. Make sure you replace it with your credentials.

Now restore the sample database which is present in the ‘inout/DB’ directory by applying following command in terminal. Open Terminal in ‘inout’ directory.

sudo su 
mysql -uroot -p lib < inout.sql 
[Enter MySQL Root password]

Replace your password in the file ‘dbconn.php’ located in ‘inout/functions’ directory, at the line number 3.
Replace the database name to ‘lib’ at line number 4.

sudo nano /usr/share/koha/opac/htdocs/inout/functions/dbconn.php
The system is ready now.
You can access it at URL given below:
http://localhost/inout/login.php

Steps for GIT Installation.

Note: Skip this if have followed Manual Installation Process. Php should be installed.

Please execute the following command to install GIT.

sudo apt-get update
sudo apt-get install git

Goto the following location and clone the package.

cd /usr/share/koha/opac/htdocs
git clone --recursive https://github.com/omkar2403/inout.git
sudo chmod 777 -R inout/

Setup the database as shown in the Manual Installation.
Replace your password in the file ‘dbconn.php’ located in inout/functions directory, in the line number 3.
Replace the database name to ‘lib’ at line number 5.
The system is ready now.
You can access it at URL given below:
http://localhost/inout/login.php

How to use this Koha plugin?

Login Credentials for In Out Management System.

There are 3 users for in out management system for various operations. Please change passwords after first login.

  1. Operator: Controls Display Screen or main screen
    username : user
    password : 123456
  2. Admin of library: Controls Single library or location admin panel and reports
    username : admin
    password : library
  3. Master: Controls all the library or location admin panel and reports
    username : master
    password : superuser

Initial setup to be done.

Login Screen of In Out Management System
Login Screen of In Out System

At the initial state first login through master login.

  • Select location as master when you login as master each time.
  • After login goto on setup tab located left side.
  • Add college or institution name, library closing time. Default name is In out management system.
  • You need to add location.
  • You can change password of users in user management tab.
  • Then logout from master.

How to use user panel?

User Screen of In Out Management System
User Screen of In Out System
  • login as operator to open the entry screen.
  • Select library name as location while login as operator.
  • This will be displayed at the entrance of the library.
  • Connect the barcode scanner to it. Then it’ll start taking entries.
  • User have to scan their id while entering into library and also when exiting the library.
  • Click on the clock to logout.

Note: You can use keyboard if barcode scanner is not available.

Usage of admin panel.

From another system which is connected to LAN with Koha system you can access the admin panel of each location.

  • login with the admin credentials and select the respected library.
  • It show the reports panel. There are three types of report. Each one can be displayed or exported into excel sheet and PDF files.
Admin Reports in In Out System.
Admin Reports in In Out System.

Features of this Koha Plugin.

There are some additional features added in In out management system version 4.

Now, you can display notices.

This management system introduced a new feature called notice. In this feature librarian can add notices of library in this Koha plugin. To add notice login as master, go to notice tab. Here you can find Head, Body and Footer for notice. Fill this and select location where the notice should be displayed.

Once you add a notice, the default image will replace with notice on the screen. You can disable notice by clicking on notice’s active button. You can add multiple notices for various locations.

Notice Panel in Koha Plugin.
Notice Panel in Koha Plugin.

Complex reports? No!

Reports for In out management system are updated to next level. This system is using Data Tables for the report generation. You can instantly export reports to Excel or PDF format. You can hide columns, search for anything or can apply filter at same time.

Master user and admin user reports are differ from each other. Master can get all location reports at same place where admin can get only respected location reports.

Master Reports in In Out Management System.
Master Reports in In Out Management System.

New way to handle user!

Now you can create multiple users for various locations. Head to user management tab in master user. Here you can create new username, name, password. Also assign them a role that is admin, master or user.

User Management System in In Out System.
User Management System in In Out System.

 


Installation of Koha18.05 on Ubuntu18.04 LTS

Step 1: Open the Terminal: 

To open the terminal, either you can search the Terminal or you can press CTRL+ALT+T together which will open terminal.
Step 2: Login with Root Privilege:s
Once your terminal is ready, you need to login with root privilege and for that run this command in terminal.
sudo su (Hit Enter) It will ask password. Enter the password carefully as it will not be visible.  
(Enter Password)
Step 3: Update the Ubuntu
In order to proceed with Installation of koha, you need to update the system with the following command. 
Run this command in terminal: 
apt-get update



Step 4: Add Koha community repository to the System: 
Now, you need to add the koha channel into Ubuntu
Run the following command one after another in terminal
echo deb http://debian.koha-community.org/koha stable main | sudo tee /etc/apt/sources.list.d/koha.list
wget -O- http://debian.koha-community.org/koha/gpg.asc | sudo apt-key add -


After adding the channel successfully, update the system again with the following command:

apt-get update
Step 5: Installation of Koha:
Once your system is updated, run the following command to install the latest release of koha. 

apt-get install koha-common 
This command will enable the system to start downloading the koha with required files and packages.
During downloading and installing, it may ask you provide some input. Proceed with default values.
Step 7: Important Configuration on koha Server:
Koha Library Management System has two interfaces:
a. Koha Staff Interface which allows the Library Staff to carry out the library work in the system.
b. Koha Online Public Access Catalogue which works as a mirror to display the bibliographical details of the items entered in the system. Generally, Online Public Access Catalogue is for library users to know about details of the items and their personal checkout history as well.
In this you have to configure two different ports for Koha Interface and Koha OPAC:
In order to change the port, open the (koha-sites.conf) file with any editor.
sudo nano /etc/koha/koha-sites.conf

Generally, I use two ports 80 for OPAC and 800
0 for Interface. The reason I do this because, I want to keep the port 80 free so that I can run any other application without any difficulty.
When the file is open I change the port
8000 - Koha OPAC (OPACPORT)
8001 - Koha Interface (INTRAPORT)
Fine the lines in file and make the changes accordingly.

OPACPORT="8000"
INTRAPORT="8001"

Step 8: Installation of MySQL Database:
To store the information, we require a database where we can store the information and use the same accordingly. This database will also enable to take the backup for future use.
Run the following command in terminal to install the MySQL database.
sudo apt-get install mysql-server
           

While installing, system may ask you to provide the password for root user of MySQL. Enter the password and keep the password safely as you will require this when you have to connect the MySQL database for any purpose mostly taking the backup.

or

Install MariaDB server

Here we use MariaDB server instead of MySQL server. Apply the following command to install the MariaDB server.

    sudo apt install mariadb-client-10.1

    sudo apt install mariadb-server

Assign Root password for MySQL

Apply following command,
sudo mysqladmin -u root password 
Enter Password
Step 9: Create the Koha Instance: 
To stand in safer side and avoid error before you create Koha Instance, run the following commands in order one after another.
sudo a2enmod rewrite
sudo a2enmod cgi
Step 10:Restart the Apache Server:
Run this command to restart the Apache Server.
sudo service apache2 stop
sudo service apache2 start
OR
sudo service apache2 restart
Step 11: Create Instance with the name 'library':
To create the same, run this command:
sudo koha-create --create-db library
Step 12: Adding ports:
The ports which you have opted to run the Koha Interface and Koha OPAC, the same ports you will have to configure in Apache Server also.
To make changes, open the following file with any editor.
sudo nano /etc/apache2/ports.conf

Find the line Listen 80 in the file. You can use
(CTRL+F) command to locate the words in the file.
Listen 80
Listen 8000
Listen 8001
Step 13:Now, Restart Apache Web Server,

sudo service apache2 restart
Enable modules and sites

sudo a2dissite 000-default
sudo a2enmod deflate
sudo a2ensite library
Now, Restart Apache Web Server,

sudo service apache2 restart

Generate the Master Password for Koha Web Installer:
Run this command to get the password:
Step 14: Start web installation of Koha
The username to log in with will be koha_library and the password can be located in the file /etc/koha/sites/library/koha-conf.xml
Apply the following command in terminal to see the koha login password,
sudo xmlstarlet sel -t -v 'yazgfs/config/pass' /etc/koha/sites/library/koha-conf.xml
You may check the command at-/etc/koha/sites/library/koha-conf.xml



Step 15: Start Koha and finish the Installation with Web Installer: 
Open following links,

http://127.0.1.1:8001 or http://localhost:8001 (Koha Stff client)
http://127.0.1.1:8000 or http://localhost:8000 (Koha Online Public Access Catalogue)

Once you login with credentials, you will get the Web Installer of Koha. Just opt the default settings and finish the Installation.

References:
  1. http://kohageek.blogspot.in/2015/05/install-koha-on-ubuntu-1404.html
  2. http://koha-community.org

Installation of Koha 20.05.02.000 on Ubuntu 20.04 LTS

Step 1: Open the Terminal:
To open the terminal, either you can search the Terminal or you can press CTRL+ALT+T together which will open terminal.
Step 2: Login with Root Privilege:s
Once your terminal is ready, you need to login with root privilege and for that run this command in terminal.
sudo su (Hit Enter) It will ask password. Enter the password carefully as it will not be visible.
(Enter Password)
Step 3: Update the Ubuntu
In order to proceed with Installation of koha, you need to update the system with the following command.
Run this command in terminal:
apt-get update



Step 4: Add Koha community repository to the System:
Now, you need to add the koha channel into Ubuntu
Run the following command one after another in terminal
echo deb http://debian.koha-community.org/koha stable main | sudo tee /etc/apt/sources.list.d/koha.list
wget -O- http://debian.koha-community.org/koha/gpg.asc | sudo apt-key add -


After adding the channel successfully, update the system again with the following command:

apt-get update
Step 5: Installation of Koha:
Once your system is updated, run the following command to install the latest release of koha.

apt-get install koha-common
This command will enable the system to start downloading the koha with required files and packages.
During downloading and installing, it may ask you provide some input. Proceed with default values.
Step 7: Important Configuration on koha Server:
Koha Library Management System has two interfaces:
a. Koha Staff Interface which allows the Library Staff to carry out the library work in the system.
b. Koha Online Public Access Catalogue which works as a mirror to display the bibliographical details of the items entered in the system. Generally, Online Public Access Catalogue is for library users to know about details of the items and their personal checkout history as well.
In this you have to configure two different ports for Koha Interface and Koha OPAC:
In order to change the port, open the (koha-sites.conf) file with any editor.
sudo nano /etc/koha/koha-sites.conf

Generally, I use two ports 80 for OPAC and 800
0 for Interface. The reason I do this because, I want to keep the port 80 free so that I can run any other application without any difficulty.
When the file is open I change the port
8000 - Koha OPAC (OPACPORT)
8001 - Koha Interface (INTRAPORT)
Fine the lines in file and make the changes accordingly.

OPACPORT="8000"
INTRAPORT="8001"

Step 8: Installation of MySQL Database:
To store the information, we require a database where we can store the information and use the same accordingly. This database will also enable to take the backup for future use.
Run the following command in terminal to install the MySQL database.
sudo apt-get install mysql-server
          

While installing, system may ask you to provide the password for root user of MySQL. Enter the password and keep the password safely as you will require this when you have to connect the MySQL database for any purpose mostly taking the backup.

or

Install MariaDB server

Here we use MariaDB server instead of MySQL server. Apply the following command to install the MariaDB server.

    sudo apt install mariadb-client-10.3

    sudo apt install mariadb-server

Assign Root password for MySQL

Apply following command,
sudo mysqladmin -u root password 
Enter Password
Step 9: Create the Koha Instance:
To stand in safer side and avoid error before you create Koha Instance, run the following commands in order one after another.
sudo a2enmod rewrite
sudo a2enmod cgi
Step 10:Restart the Apache Server:
Run this command to restart the Apache Server.
sudo service apache2 stop
sudo service apache2 start
OR
sudo service apache2 restart
Step 11: Create Instance with the name 'library':
To create the same, run this command:
sudo koha-create --create-db library
Step 12: Adding ports:
The ports which you have opted to run the Koha Interface and Koha OPAC, the same ports you will have to configure in Apache Server also.
To make changes, open the following file with any editor.
sudo nano /etc/apache2/ports.conf

Find the line Listen 80 in the file. You can use
(CTRL+F) command to locate the words in the file.
Listen 80
Listen 8000
Listen 8001
Step 13:Now, Restart Apache Web Server,

sudo service apache2 restart
Enable modules and sites

sudo a2dissite 000-default
sudo a2enmod deflate
sudo a2ensite library
Now, Restart Apache Web Server,

sudo service apache2 restart

Generate the Master Password for Koha Web Installer:
Run this command to get the password:
Step 14: Start web installation of Koha
The username to log in with will be koha_library and the password can be located in the file /etc/koha/sites/library/koha-conf.xml
Apply the following command in terminal to see the koha login password,
sudo xmlstarlet sel -t -v 'yazgfs/config/pass' /etc/koha/sites/library/koha-conf.xml
You may check the command at-/etc/koha/sites/library/koha-conf.xml



Step 15: Start Koha and finish the Installation with Web Installer:
Open following links,

http://127.0.1.1:8001 or http://localhost:8001 (Koha Stff client)
http://127.0.1.1:8000 or http://localhost:8000 (Koha Online Public Access Catalogue)

Once you login with credentials, you will get the Web Installer of Koha. Just opt the default settings and finish the Installation.

References:
  1. http://kohageek.blogspot.in/2015/05/install-koha-on-ubuntu-1404.html
  2. http://koha-community.org

 

Install perl modules through CPAN on Debian/ Ubuntu

After installation of Koha on Debian, it seems that installation of remaining cpan modules (e.g. Data::Pagination) reluctant to install via terminal. We need to install following package to install CPAN modules properly:


su
apt-get install build-essential

Then try to install cpan modules from terminal,

cpan
install Package::Name

e.g. install Data::Pagination :Language

Reference-Koha Geek

How to Koha OPAC New Arrivals Books Display

1.To set up the Koha plugin system you must first make some changes to your installation. 

Visit the Video

sudo gedit /etc/koha/sites/library/koha-conf.xml

In the xml file Change <enable_plugins>0<enable_plugins> to
                                     <enable_plugins>1</enable_plugins>


2.Download the Carousel Plugin kpz file.


3.Go to: Koha Home › Tools › Plugins › Upload Plugin (Carrousel.kpz)


4. Go to: Koha Home › Lists  New Lists  Create 'New Arrivals' Public list

    Add the New Arrivals items Barcodes: For example barcode 22300, 22301, 22302

5.Go to: Plugin Carrousel Click Actions 'Configure' (Select New Arrivals and change Bg color Etc..)


6.Go to: Plugin Carrousel Click Actions 'Run tool'


7. Generate carrousel ( Select New Arrivals ) and Click Generate


8. Go to: OPAC page and Refresh page.


Reference:

1. https://inlibro.com/ 


2. http://libtechnophile.blogspot.com




DBMS Auto Increment(Delete circulation entries from databse tables)


Certain records reluctant to Checkin due to DBMS auto increment problem. In such cases, the transaction remains in the tables. Developers still working on the solution. Here is a temporary solution. I tried this steps on Koha installed on Debian 8,9 and Ubuntu 16.04 with MySQL and MariaDB Server.

Symptoms of DB increment problem
Record reluctant to check-in.

See the message when trying to check-in the book.
Check Koha > About > System Information where you can find affected tables and entries in it.
Find the entries duplicated.
Clean the wrong entries from the affected tables
The problem often affected on deletedbiblio, deleteditems, deletedborrowers and old_issues tables in Koha database. We have to access the database of Koha and delete that specific entry. Then we apply DBMS auto increment fix. First identify the tables with wrong entries. Apply SQL queries to delete the wrong entries;

Log into MySQL/MariaDB

sudo mysql -uroot -p

use koha_library;

Apply following SQL query to delete the wrong entries from old_issues table;

DELETE FROM old_issues WHERE issue_id IN (Copy and paste issue IDs inside the brackets);

e.g. DELETE FROM old_issues WHERE issue_id IN (910,909,908,911);

Delete wrong entries from deletedbiblio

DELETE FROM deletedbiblio WHERE biblionumber IN (Copy and paste biblio numbers inside the brackets);

Delete wrong entries from deleteditems

DELETE FROM deleteditems WHERE biblionumber IN (Copy and paste biblionumbers inside the brackets);

Delete wrong entries from deletedborrowers

DELETE FROM deletedborrowers WHERE borrowernumber IN (Copy and paste borrower numbers inside the brackets);

Exit from MySQL after the deletion of wrong entries from all tables. Apply the following command;

exit
Check again Koha > About Koha > System Information after deleting all wrong entries from affected tables.
Reference-Koha Geek

How to Enable Export Database Function In Koha Tools

New version Koha comes without enabling export database function in koha tools by default.So in order to take backup from the Graphical User Interface (GUI) we need to enable the function in koha instance's config file.Then only we can have database dumps via koha tool.


Enable database and configuration dumps via Koha tools 

1.Open terminal and edit your koha instance's config file using the following command.
sudo nano /etc/koha/sites/library/koha-conf.xml
Where "library" is the name of  koha instance for which I want to enable backups via tools (replace "library" with your instance name)
2. Scroll down around line 291 where it says

<!-- Enable the two following to allow super librarians to download
      database and configuration dumps (respectively) from the Export
      tool -->
3. Enable database backups via tools by changing the line
 
<backup_db_via_tools>0</backup_db_via_tools>

<backup_db_via_tools>1</backup_db_via_tools>
( Note that we are simply changing "0" to "1" (from "off" to "on")

4. Enable database backups via tools by changing the line
<backup_conf_via_tools>0</backup_conf_via_tools>

<backup_conf_via_tools>1</backup_conf_via_tools>
( Note that we are simply changing "0" to "1" (from "off" to "on")

5. Save your changes (if you are using nano editor, press control + O) and Reboot your system/server. Now go on to the next step
Backup your Koha Database and Configuration file via Koha Tools

1. Log into to koha administration interface on your web browser.
2. Go to Home > Tools
3. Click on Export Data
4. To export your database, click on Export Database > Select the Database > Download Database
5. To export your configuration file, click on Export Configuration File > Select the Configuration File > Download Configuration File




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 su
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 su
mysql -uroot -p 
[Enter the 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 su
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.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

5. Rebuild the Zebra Index.

Apply following command in a terminal,

sudo koha-rebuild-zebra -v -f library

Reference-Koha Geek

Unable to check-in(Error) -The item has not been checked in due to a configuration issue in your system.

Delete circulation entries from databse tables (DBMS auto increment)

Certain records reluctant to Checkin due to DBMS auto increment problem. In such cases, the transaction remains in the tables. Developers still working on the solution. Here is a temporary solution. I tried this steps on Koha installed on Debian 8,9 and Ubuntu 16.04 with MySQL and MariaDB Server.

Symptoms of DB increment problem
Record reluctant to check-in.

See the message when trying to check-in the book.
Check Koha > About > System Information where you can find affected tables and entries in it.
Find the entries duplicated.
Clean the wrong entries from the affected tables
The problem often affected on deletedbiblio, deleteditems, deletedborrowers and old_issues tables in Koha database. We have to access the database of Koha and delete that specific entry. Then we apply DBMS auto increment fix. First identify the tables with wrong entries. Apply SQL queries to delete the wrong entries;

Log into MySQL/MariaDB

sudo mysql -uroot -p

use koha_library;

Apply following SQL query to delete the wrong entries from old_issues table;

DELETE FROM old_issues WHERE issue_id IN (Copy and paste issue IDs inside the brackets);

e.g. DELETE FROM old_issues WHERE issue_id IN (910,909,908,911);

Delete wrong entries from deletedbiblio

DELETE FROM deletedbiblio WHERE biblionumber IN (Copy and paste biblio numbers inside the brackets);

Delete wrong entries from deleteditems

DELETE FROM deleteditems WHERE biblionumber IN (Copy and paste biblionumbers inside the brackets);

Delete wrong entries from deletedborrowers

DELETE FROM deletedborrowers WHERE borrowernumber IN (Copy and paste borrower numbers inside the brackets);

Exit from MySQL after the deletion of wrong entries from all tables. Apply the following command;

exit
Check again Koha > About Koha > System Information after deleting all wrong entries from affected tables.

DBMS auto increment fix as per Koha Wiki

For MySQL with Ubuntu 16.04 LTS,

sudo leafpad /etc/mysql/my.cnf

For MySQL with Ubuntu 18.04 LTS,
 
sudo leafpad /etc/mysql/mysql.conf.d/mysqld.cnf

For MariaDB with Ubuntu 16.04 and Debian 9,

sudo leafpad /etc/mysql/mariadb.conf.d/50-server.cnf 

Place following line under [mysqld]. Hope that your Koha DB name is koha_library, otherwise change the DB name in the line;

init-file=/var/lib/mysql/init-file_koha_library.sql

Save and close the file.

Create a new file, remember to add the DB name at the end of the line.

sudo leafpad /var/lib/mysql/init-file_koha_library.sql

Copy and paste the following lines into the file and save, close. Replace the Koha DB name in the first line.

USE koha_library;
SET @new_AI_borrowers = ( SELECT GREATEST( IFNULL( ( SELECT MAX(borrowernumber) FROM borrowers ), 0 ), IFNULL( ( SELECT MAX(borrowernumber) FROM deletedborrowers ), 0 ) ) + 1 );
SET @sql = CONCAT( 'ALTER TABLE borrowers AUTO_INCREMENT = ', @new_AI_borrowers );
PREPARE st FROM @sql;
EXECUTE st;
SET @new_AI_biblio = ( SELECT GREATEST( IFNULL( ( SELECT MAX(biblionumber) FROM biblio ), 0 ), IFNULL( ( SELECT MAX(biblionumber) FROM deletedbiblio ), 0 ) ) + 1 );
SET @sql = CONCAT( 'ALTER TABLE biblio AUTO_INCREMENT = ', @new_AI_biblio );
PREPARE st FROM @sql;
EXECUTE st;
SET @new_AI_biblioitems = ( SELECT GREATEST( IFNULL( ( SELECT MAX(biblioitemnumber) FROM biblioitems ), 0 ), IFNULL( ( SELECT MAX(biblioitemnumber) FROM deletedbiblioitems ), 0 ) ) + 1 );
SET @sql = CONCAT( 'ALTER TABLE biblioitems AUTO_INCREMENT = ', @new_AI_biblioitems );
PREPARE st FROM @sql;
EXECUTE st;
SET @new_AI_items = ( SELECT GREATEST( IFNULL( ( SELECT MAX(itemnumber) FROM items ), 0 ), IFNULL( ( SELECT MAX(itemnumber) FROM deleteditems ), 0 ) ) + 1 );
SET @sql = CONCAT( 'ALTER TABLE items AUTO_INCREMENT = ', @new_AI_items );
PREPARE st FROM @sql;
EXECUTE st;
SET @new_AI_issues = ( SELECT GREATEST( IFNULL( ( SELECT MAX(issue_id) FROM issues ), 0 ), IFNULL( ( SELECT MAX(issue_id) FROM old_issues ), 0 ) ) + 1 );
SET @sql = CONCAT( 'ALTER TABLE issues AUTO_INCREMENT = ', @new_AI_issues );
PREPARE st FROM @sql;
EXECUTE st;
SET @new_AI_reserves = ( SELECT GREATEST( IFNULL( ( SELECT MAX(reserve_id) FROM reserves ), 0 ), IFNULL( ( SELECT MAX(reserve_id) FROM old_reserves ), 0 ) ) + 1 );
SET @sql = CONCAT( 'ALTER TABLE reserves AUTO_INCREMENT = ', @new_AI_reserves );
PREPARE st FROM @sql;
EXECUTE st;

Restart MySQL

sudo service mysql restart

Reference:-Koha Geek