Install Koha on Debian

Install Debian Linux

Koha officially support Debian. Download Debian 9 (Stretch) with XFCE desktop (64 bit) from the following link. Remember (for beginners) to download Debian XFCE desktop CD.

Insert the medium, change the boot option of the computer and start the installation process of Debian. See the below video and familiar with the installation process of Debian.

Write down root password and user names in a diary or a piece of paper.

Prepare Debian sources list
Need to make some changes in sources.list file

Open a command terminal,
Applications > System >  XFCE Terminal and open sources list.

Login as Root user,

su  [Enter Root Password]

Open sources.list in nano editor.

mousepad /etc/apt/sources.list   

[Mousepad is a text editor with XFCE Desktop]

Step 1. Delete/comment out [Put # infront of each lines] all entries in the file.

Step 3. Copy and paste following lines in the file,

###### Debian Main Repos
deb stable main contrib non-free
deb-src stable main contrib non-free
deb stable-updates main contrib non-free
deb-src stable-updates main contrib non-free
deb stable/updates main
deb-src stable/updates main
deb stretch-backports main
deb-src stretch-backports main

Save and close the file
Update the repository,

apt-get update
apt-get upgrade

Install sudo in Debian
Sudo is a tool available default with Ubuntu, which allows users to execute administrative tasks (e.g. installation, remove etc). Sudo tool gives the convenience of applying Ubuntu commands.

Apply following commands one by one,

apt-get install sudo

Add default user to sudo

adduser username sudo  [Replace username with yours]

Restart/Logout computer to enable sudo.

Update Debian Linux

Open a Terminal and apply following commands,

sudo apt-get update
sudo apt-get upgrade

Install Leafpad text editor
Leafpad is a lightweight Text Editor and convenient for new Linux users to open and edit various configuration files while the installation process of Koha. Install also file-roller, and Printer settings. Both packages not available wt

sudo apt-get install leafpad file-roller system-config-printer

Add Koha community repository

Add Koha software channel into Debian. It will install the current (latest) version of Koha. Apply following two commands one by one:

echo deb stable main | sudo tee /etc/apt/sources.list.d/koha.list

wget -O- | sudo apt-key add -

Update the software repository

sudo apt-get update

Install Koha

The following command will install latest release of Koha.

sudo apt-get install koha-common

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

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

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


Install MariaDB server

Apply the following command to install MariaDB server.

sudo apt-get install mariadb-server

Assign Root password for MySQL

Apply following command,

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

Koha instance creation
Apply 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 leafpad /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

Change Koha default master password

See the following link

Restart Memcached

sudo service memcached restart

Clear command history

For security purpose, clear history of commands input while installing Koha. Aplly following commands;

sudo su
history -c

How to start Koha
Open following links, (Stff client) (Online catalogue)



  1. Dear Vimal, exellent tutorial tested on VM,
    the only shadow is that it appears slow and in about/system information i get:
    Warning You are missing the entry in your koha-conf.xml file. That will bring a performance boost to enable it.
    I have no idea how to fix it!
    May you have some precious advices there!?!
    Thanks a lot
    Warm Regards

    1. You can ignore that message.
      To increase speed of the Koha, try to enable plack,

  2. Dear Sir This link Not Work
    Pls Update Downloadable Link Sir

  3. Hello! Please I used a USB flash drive to do the installation. Therefore I could not install sudo. What do I do?

    1. Apply following commands,
      apt-get install sudo
      adduser username sudo [Replace the username with the username of your pc, e.g. adduser koha sudo]