Install Koha on Ubuntu

Install Ubuntu 22.04 and update
Koha can install various Ubuntu flavours like Xubuntu/Lubuntu. Xubuntu and Lubuntu are lightweight (fast-performance) Ubuntu flavours. Download the Linux iso file from either Xubuntu/Lubuntu from websites. Burn in a DVD or pen drive/DVD. Install the Linux operating system. 

Open the Terminal and get ready for installation
Open Applications > System Tools > Terminal and apply the commands one by one mentioned on this page.

Update Ubuntu
This process will update the Linux operating system latest by downloading new packages.

sudo apt update
sudo apt upgrade

Install Mousepad text editor

The mousepad is a lightweight text editor, which requires opening configuration files during the installation process of Koha.

sudo apt -y install mousepad

Add Koha community repository

Add Koha software channel into Ubuntu. Here we add the old stable version of Koha. We can define which version to install when adding the repository. Visit the Koha Wiki for details. Apply the following two commands one by one:

sudo sh -c 'wget -qO - https://debian.koha-community.org/koha/gpg.asc | gpg --dearmor -o /usr/share/keyrings/koha-keyring.gpg'

sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/koha-keyring.gpg] https://debian.koha-community.org/koha oldstable main" >> /etc/apt/sources.list.d/koha.list'

Update the software repository.

sudo apt update

Install MariaDB server


sudo apt install -y mariadb-server

Assign Root password for MariaDB

If the password asks during installation, enter the password in the window. Apply the following command, if the password window did not appear during the installation,

sudo mysqladmin -u root password newpass       [Replace 'newpass']

Install Koha

The following command will install the latest release of Koha.

sudo apt install -y koha-common

Server configuration

In this step, need to edit network information like domain name and port numbers.

sudo mousepad /etc/koha/koha-sites.conf

Here I change the port number of the Koha staff client to 8080. Find the following line in the file and make changes.

INTRAPORT="8080"


Koha instance creation

Apply the following commands to create Apache configuration files.

sudo a2enmod rewrite
sudo a2enmod cgi
sudo service apache2 restart

Create a Koha instance with the name library. 

sudo koha-create --create-db library

Add new port

We have assigned 8080 port for the Koha staff client and 80 for OPAC.
Open the following file and add a new port.

sudo mousepad /etc/apache2/ports.conf

Copy-paste following line below Listen 80

Listen 8080

Restart Apache,

sudo service apache2 restart


Enable modules and sites

sudo a2dissite 000-default
sudo a2enmod deflate
sudo a2ensite library
sudo service apache2 restart


Setup the library

After the successful installation, you need to create initial parameters (e.g. branch, item type, superuser creation etc) to start with Koha. We need to open the web interface of Koha and start the configuration of Koha to start.
Restart the Memcached service to open Koha web installer.

sudo service memcached restart

Open the following link in the web browser to open the staff client of Koha and set up the library,

http://127.0.1.1:8080 

Enter into the Koha staff client using the Database username and password of koha_library. It can find from the file, /etc/koha/sites/library/koha-conf.xml. Apply the following file in a terminal.

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

Search (Ctrl+F) for the segment MySQL in the text editor. Note down the database username and password and log into Koha web installer.

Change Koha default master password (Optional)

The password for the Koha database name was created during the installation process. The user can change the Koha database password. See the following link,

Reference

56 comments:

  1. Thing went well, right? Today i will try this! Long time no work with Koha. How are u Vimal?

    ReplyDelete
  2. things went bad when installing PERL missing modules. Need a lil help mate....

    ReplyDelete
  3. i have been trying to install koha on ubuntu server 14.04 to no avail
    the already install moodle, the e learning software but the configurations i made during the Apache is giving me headeache since most sites cannot be enable

    ReplyDelete
  4. great instructions, thank you! just got lost when i tried to login on the webinterface, receved this error. can anyone please help? Can't call method "do" on unblessed reference at /usr/share/koha/lib/C4/Context.pm line 793.

    ReplyDelete
  5. Change the following CPAN command to use "DBIx" instead of "DBix" and everything works perfectly.
    install Test::DBix::Class
    - change to -
    install Test::DBIx::Class

    It's a subtle correction to avoid an error in finding the resource from CPAN.

    Thanks!!

    ReplyDelete
  6. I need help!! After restarting my computer i cannot launch the Koha again. I tried to restart the apache2 it also failed saying:
    * Restarting web server apache2 [fail]
    * The apache2 configtest failed.
    Output of config test was:
    Segmentation fault
    Action 'configtest' failed.
    The Apache error log may have more information.

    ReplyDelete
  7. apache server is starting without any error. But getting below error at the browser to open koha:

    Software error:

    DBIx::Class::Storage::DBI::catch {...} (): DBI Connection failed: Access denied for user 'koha_library'@'localhost' (using password: YES) at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1398. at /usr/share/koha/lib/Koha/Database.pm line 90
    Compilation failed in require at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 32.
    BEGIN failed--compilation aborted at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 32.

    For help, please send mail to the webmaster ([no address given]), giving this error message and the time and date of the error.

    Tried to see the code mechanism but it is non-rewriteable.

    ReplyDelete
  8. Apache server is starting properly. But in browser getting below error:

    Software error:

    DBIx::Class::Storage::DBI::catch {...} (): DBI Connection failed: Access denied for user 'koha_library'@'localhost' (using password: YES) at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1398. at /usr/share/koha/lib/Koha/Database.pm line 90
    Compilation failed in require at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 32.
    BEGIN failed--compilation aborted at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 32.

    For help, please send mail to the webmaster ([no address given]), giving this error message and the time and date of the error.

    -----------------------------------------------------------------------------
    Tried to see the code mechanism but those are non-rewriteable...
    Please suggest further steps..

    ReplyDelete
  9. I have the same problem The install seems to go fine, but I had to create a symlink from koha-sites.conf (in the koha directory) to library.conf (in the apache2/sites-available directory). Apache seems to read the file OK, but when I restart, apache says:

    The apache2 configtest failed. Not doing anything.
    Output of config test was:
    AH00526: Syntax error on line 8 of /etc/apache2/sites-enabled/library.conf:
    Invalid command 'DOMAIN="ihm-school.org"', perhaps misspelled or defined by a module not included in the server configuration

    ReplyDelete
  10. I have the same problem The install seems to go fine, but I had to create a symlink from koha-sites.conf (in the koha directory) to library.conf (in the apache2/sites-available directory). Apache seems to read the file OK, but when I restart, apache says:

    The apache2 configtest failed. Not doing anything.
    Output of config test was:
    AH00526: Syntax error on line 8 of /etc/apache2/sites-enabled/library.conf:
    Invalid command 'DOMAIN="ihm-school.org"', perhaps misspelled or defined by a module not included in the server configuration

    ReplyDelete
  11. I have the same problem The install seems to go fine, but I had to create a symlink from koha-sites.conf (in the koha directory) to library.conf (in the apache2/sites-available directory). Apache seems to read the file OK, but when I restart, apache says:

    The apache2 configtest failed. Not doing anything.
    Output of config test was:
    AH00526: Syntax error on line 8 of /etc/apache2/sites-enabled/library.conf:
    Invalid command 'DOMAIN="ihm-school.org"', perhaps misspelled or defined by a module not included in the server configuration

    ReplyDelete
  12. Successfully installed Koha 3.22.06 on Ubuntu 14,04... thank You sir

    ReplyDelete
    Replies
    1. Hi..Anupam!!
      How did you do that?
      Can you help with the installation steps?

      Thank you,
      Manindra.

      Delete
  13. I am failing to create koha instance on koha 3.22 on ubuntu 14.04. The following error is popping up.

    dmilibrary2016@dmilibrary:~$ sudo koha-create --create-db dmilibrary
    awk: fatal: cannot open file `/etc/mysql/koha-common.cnf' for reading
    (No such file or directory)

    Johnstone Selemani

    ReplyDelete
  14. Hi. I got this error during the installation. Can someone help me to fix this? It happen during browser installation of koha, not in the terminal.

    install.pl: DBD::mysql::st execute failed: BLOB, TEXT, GEOMETRY or JSON column 'defaultvalue' can't have a default value at /usr/share/perl5/DBIx/RunSQL.pm line 273.

    ReplyDelete
  15. Sir, I want to install on a web hosing which i have been buy a domain
    how to solve it?

    ReplyDelete
  16. Dear sir,

    may i installed KOHA in same computer where the Dspace is already available in 14.4 Ubuntu surface.

    ReplyDelete
    Replies
    1. Sir,
      You can install Dspace along with Koha.
      Remember to change the port number of Koha staff client 8080 to 8000.
      Dspace using the port number 8080.
      Check the following link,
      http://kohageek.blogspot.in/2014/02/how-to-change-default-port-number-of.html

      Delete
  17. hi vimal
    i'malready install koha on ubuntu 14.4 lts but when i tried to open opac
    i faced that : Apache2 Ubuntu Default Page

    what can i do to redirect that to Koha opac

    thnxs

    ReplyDelete
  18. Good day sir, I am getting this error from installation via the browser:

    [Fri Jul 29 10:43:51 2016] install.pl: DBD::mysql::st execute failed: BLOB, TEXT, GEOMETRY or JSON column 'defaultvalue' can't have a default value at /usr/share/perl5/DBIx/RunSQL.pm line 273.

    ReplyDelete
  19. Dear sir
    I got this error "unable to locate koha-common". please let me know how to fix this.

    ReplyDelete
  20. dear sir,
    I wanted to install koha on laptop for practice.Please provide required information with links.Presently,installed ubuntu 16.04 and downloaded koha live cd 1.1 gb.Then guide me what to do.

    ReplyDelete
    Replies
    1. You can install Virtualbox and install live dvd in it.
      https://www.virtualbox.org/wiki/VirtualBox_PUEL

      Delete
  21. dear sir,

    Koha live dvd there are two files. 1 Koha 16.05 2 Koha 3.22.5.Which one tobe downloaded sir

    ReplyDelete
    Replies
    1. 16.05 is the latest version.
      3.22.x is old stable version.

      Delete
    2. sir,
      I have database in cds/isis. The data is converted into marc file.Then I imported data into koha. while searching for data on opac . The data is browsing but availability of the record shows no item available.what are the Global system preferences to be changed.Pl suggest me.
      regards

      Delete
    3. Check 952 item information tag.
      I think it does not added properly.

      Delete
  22. i add multi counter station . one is always sip server up, second one frequently disconnected . please help how to set more than one counter station via please reply to my mail mail2prk@gmail.com .Thanks for your support

    ReplyDelete
  23. please send me auto indexing command for crontab.....Praveen Kumar....Praveenvasu.crl@gmail.com

    ReplyDelete
  24. please send me auto indexing command for crontab......praveenvasu.crl@gmail.com

    ReplyDelete
    Replies
    1. Newly added records automatically add to index in specific intervals.

      Delete
  25. sir,
    I am working on Koha 16.05.I imported data in to koha.Then now i wanted to delete data from koha.(cleaned staged files ) how can i delete completely.

    ReplyDelete
  26. Unimport the data, Tools > Marc Records Management

    ReplyDelete
  27. Can I install Koha to my website, to manage my library.

    ReplyDelete
    Replies
    1. Check your hosting space suitable to apply commands to install Koha.

      Delete
  28. sir i also want to install koha for my library but i do not know how to deal with koha .
    poonam77a@gmail.com

    ReplyDelete
    Replies
    1. If you try to Koha, please use Koha Live DVD
      https://drive.google.com/drive/folders/0B3FZ9iUzgfcmSE5WZEdEeV9FSm8

      Delete
  29. hello, I was trying to install koha on ubuntu 14.04 I am following your instructions but sadly saying I failed several times. sometimes I get the following: "unable to correct problems, you have held unbroken packages" and sometimes I get this: "unable to locate koha-common" please help..thanks in advance

    ReplyDelete
  30. Dear sir,
    I am getting this problem during inttalling koha on my system
    "Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    koha-common : Depends: libgd-perl but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    root@Ubuntu1:/home/deepak#"

    Can you help me to solve this problem?

    ReplyDelete
    Replies
    1. Download libgd-perl package from following link and install manually.
      http://packages.ubuntu.com/trusty/libgd-perl
      Then try to install Koha.

      Delete
  31. Dear Sir,

    I've successfully install Koha 16.11.03 on ubuntu 15.04 using you guideline, Thank you.

    Actually, I've another server installed with Koha 3.16.01, but the server using CentOS 6. I've a planned to update & upgrade the koha version. Do you have a guideline to upgrade the koha version?

    Thank you

    ReplyDelete
    Replies
    1. http://kohageek.blogspot.in/search/label/update

      Delete
  32. Dear Sir,
    I have successfully install koha on ubuntu 16.04 using your guidline, Thank You

    ReplyDelete
  33. Please help



    Warning: You are logged in as the database administrative user. This is not recommended because some parts of Koha will not function as expected when using this account.

    Please log in instead with a regular staff account. To create a staff account, create a library, a patron category 'Staff' and add a new patron. Then give this patron permissions from 'More' in the toolbar.



    Software error:

    Template process failed: undef error - DBIx::Class::Storage::DBI::_dbh_execute(): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'koha_library.me.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by at /usr/share/koha/lib/Koha/Objects.pm line 120

    For help, please send mail to the webmaster ([no address given]), giving this error message and the time and date of the error.

    ReplyDelete
    Replies
    1. Create a staff patron
      http://kohageek.blogspot.in/2015/02/add-staff-patron.html

      Delete
  34. Sir why MariaDB server instead of MySQL server?

    ReplyDelete
    Replies
    1. https://wiki.koha-community.org/wiki/Koha_on_ubuntu_-_packages#Ubuntu_16.04_and_MySQL_5.7

      Delete
  35. Hi there,

    Since July last year, I am trying to install Koha on my Ubuntu environment, which is now Ubuntu 17.10 OS, following the link of Koha Wiki, koha on ubuntu- packages. One of my computer has successfully installed Koha on it but my current attempting one still haven't got no luck. I went through the process a couple of times, and it shows error message like

    ***************************************************************************************
    DBIx::Class::Storage::DBI::catch {...} (): DBI Connection failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1520. at /usr/share/koha/lib/Koha/Database.pm line 100
    *********************************************************************************************

    Once I updated Perl in my attempt which took me 50 minutes or so to wait until the update was completed, however I still have no luck.

    Would you be able to help me?
    Regards,
    Toshi

    ReplyDelete
    Replies
    1. Koha support Ubuntu 16.04 LTS. Try it.

      Delete
    2. Thank you for your prompt reply!

      Yes, I have done it already, however, that Ubuntu 16.04, which I have burnt the ISO into a disk, have given me errors while it automatically updating itself,therefore I needed to upgrade it until Ubuntu satisfies itself for own update.

      If you suggest, I will try it today and see how it goes. I mean I understand the developers keep on updating this OS so I may have luck if I do it now, compared to what I did a couple of months ago...

      Delete
    3. After installing the Live DVD, user can upgrade to latest version of Koha.

      Delete

  36. Dear Vimal,
    I am trying to koha on unbunt 18.04 When i am executing sudo koha-create --create-db library i am getting the following error. Please help me to fix the issue.



    root@koha-Sever:/etc/koha# sudo koha-create --create-db library
    /etc/koha/koha-sites.conf: line 61: unexpected EOF while looking for matching `"'
    root@koha-Sever:/etc/koha# ^C
    root@koha-Sever:/etc/koha#

    ReplyDelete
    Replies
    1. Koha prefers Ubuntu 16.04. Koha is not ready to use with Ubuntu 18.04 LTS.

      Delete