Install Koha on Debian 9 (Stretch)

Install Debian Linux

This Debian image comes with XFCE Desktop. Download Debian 64 bit from the following link and burn in a CD/DVD/Pen Drive. Insert the medium, change the boot option of the computer and start the installation process of Debian 9.

See the below video and familiar with the installation process of Debian 9.

Write down root password and usernames 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.

nano /etc/apt/sources.list

Step 1. Put # special charecter infront of CD-ROM source lines.
Step 2. and 3. Remove # from Debian repository.

Step 3. Copy and paste following two lines at the bottom of the file,

deb stretch main contrib non-free
deb-src stretch main contrib non-free

Save the file, Press Ctrl+O button.
Exit from the file, Press Ctl+X button.

Update the repository,

apt-get update

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 the user to sudoer's List

Apply following command,

adduser username sudo

[Replace the username with the username of your pc, e.g. adduser koha sudo]

Restart/Logout computer to start sudo tool.

Update Debian Linux

Open a Terminal and apply following commands,

sudo apt-get update
sudo apt-get upgrade

Install Chromium browser

Default browser does not open due to a  [bug]. 
Install Chromium browser instead of the default browser.

sudo apt-get install chromium

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.

sudo apt-get install leafpad

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 MySQL server

Apply the following command to install MySQL server.

sudo apt-get install mariadb-server

Assign Root password for MySQL

Apply following commands one by one,

sudo su
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 following file and add 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

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,