St. Mary's School

Home About Us Join Us

Our Koha


Sources.list

sudo nano /etc/apt/sources.list

Copy and paste:

contrib non-free

sudo apt update && sudo apt upgrade -y


Date

sudo date

sudo dpkg-reconfigure tzdata

Select the continent of your choice using the arrow keys and press Enter.
Select your region using the arrow keys and press Enter.

Apache2 install

sudo apt-get install apache2 -y

sudo a2dismod mpm_event

sudo a2dismod mpm-worker

sudo a2enmod mpm_prefork

sudo systemctl restart apache2

Directories

sudo mkdir -p /var/www/yourdomain.org/public_html

sudo mkdir -p /var/www/koha-install.yourdomain.org/public_html

sudo mkdir -p /var/www/library.yourdomain.org/public_html

sudo mkdir -p /var/www/library-intra.yourdomain.org/public_html

Apache2 security

sudo chown -R $USER:$USER /var/www/yourdomain.org

sudo chown -R $USER:$USER /var/www/koha-install.yourdomain.org

sudo chown -R $USER:$USER /var/www/library.yourdomain.org

sudo chown -R $USER:$USER /var/www/library-intra.yourdomain.org

sudo chmod -R 755 /var/www

000-default

sudo touch /etc/apache2/sites-available/000-default.conf

sudo nano /etc/apache2/sites-available/000-default.conf

Copy and paste:
# domain: yourdomain.org
# public: /var/www/yourdomain.org/public_html/

<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin admin@yourdomain.org
ServerName yourdomain.org
ServerAlias www.yourdomain.org

Redirect "/" "https://yourdomain.org/"

# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/yourdomain.org/public_html

# Log file locations
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Default-ssl

sudo touch /etc/apache2/sites-available/default-ssl.conf

sudo nano /etc/apache2/sites-available/default-ssl.conf
Copy and paste:
# domain: yourdomain.org
# public: /var/www/yourdomain.org/public_html/

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@yourdomain.org
ServerName yourdomain.org
ServerAlias www.yourdomain.org
DirectoryIndex index.html index.php
DocumentRoot /var/www/yourdomain.org/public_html

LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLEngine on
SSLCertificateFile /etc/ssl/certs/yourdomain.org.crt
SSLCertificateKeyFile /etc/ssl/private/yourdomain.org.key
SSLCACertificateFile /etc/ssl/certs/ca-certificates.crt
<FilesMatch "\.(cgi|shtml|phtml|php)$" >
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
</IfModule>

Main page

sudo nano /var/www/yourdomain.org/public_html/index.html

Copy and paste:
<html>
<head>
<title>Welcome to YourDomain! </title>
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png>
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png>
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png>
<link rel="manifest" href="/images/site.webmanifest">
</head>
<body>
<p>
<h1>Coming soon! The YourDomain website! </h1>
</br>
<img src="/images/image09.jpg" alt="Learning to put things in alphabetical order" width="1602" height="1068">
</p>
</body>
</html>
Ctrl+O and Enter to save; Ctrl+X and Enter to exit.

sudo touch /etc/apache2/sites-available/yourdomain.org.conf

sudo nano /etc/apache2/sites-available/yourdomain.org.conf

Copy and paste:
# domain: yourdomain.org
# public: /var/www/yourdomain.org/public_html/

<VirtualHost *:80>
ServerAdmin webmaster@yourdomain.org
ServerName yourdomain.org
ServerAlias www.yourdomain.org

DirectoryIndex index.html index.php
DocumentRoot /var/www/yourdomain.org/public_html

LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Subpage 1

sudo nano /var/www/library.yourdomain.org/public_html/index.html

Copy and paste:
<html>
<head>
<title>Welcome to YourDomain Library! </title>
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png>
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png>
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png>
<link rel="manifest" href="/images/site.webmanifest">
</head>
<body>
<p>
<h1>Coming soon! The YourDomain Library Web page! </h1>
</br>
<img src="/images/image01.jpg" alt="Helping out in the library" width="1602" height="1068">
</p>
</body>
</html>
Ctrl+O and Enter to save; Ctrl+X and Enter to exit.

sudo touch /etc/apache2/sites-available/library.yourdomain.org.conf

sudo nano /etc/apache2/sites-available/library.yourdomain.org.conf

Copy and paste:
# domain: library.yourdomain.org
# public: /var/www/library.yourdomain.org/public_html/

<VirtualHost *:80>
ServerAdmin webmaster@yourdomain.org
ServerName library.yourdomain.org

DirectoryIndex index.html index.php
DocumentRoot /var/www/library.yourdomain.org/public_html

LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Subpage 2

sudo nano /var/www/library-intra.yourdomain.org/public_html/index.html

Copy and paste:
<html>
<head>
<title>Welcome to the YourDomain Library staff page! </title>
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png>
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png>
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png>
<link rel="manifest" href="/images/site.webmanifest">
</head>
<body>
<p>
<h1>Coming soon! The YourDomain Library staff page! </h1>
</br>
<img src="/images/image04.jpg" alt="Learning about the library" width="1602" height="1068">
</p>
</body>
</html>
Ctrl+O and Enter to save; Ctrl+X and Enter to exit.

sudo touch /etc/apache2/sites-available/library-intra.yourdomain.org.conf

sudo nano /etc/apache2/sites-available/library-intra.yourdomain.org.conf

Copy and paste:
# domain: library-intra.yourdomain.org
# public: /var/www/library-intra.yourdomain.org/public_html/

<VirtualHost *:80>
ServerAdmin webmaster@yourdomain.org
ServerName library-intra.yourdomain.org

DirectoryIndex index.html index.php
DocumentRoot /var/www/library-intra.yourdomain.org/public_html

LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Subpage 3

sudo nano /var/www/koha-install.yourdomain.org/public_html/index.html

Copy and paste:
<html>
<head>
<title>Welcome to the Koha Install website! </title>
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png>
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png>
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png>
<link rel="manifest" href="/images/site.webmanifest">
</head>
<body>
<p>
<h1>Coming soon! The Koha Install Web page! </h1>
</br>
<img src="/images/image07.jpg" alt="Using the library" width="1602" height="1068">
</p>
</body>
</html>
Ctrl+O and Enter to save; Ctrl+X and Enter to exit.

sudo touch /etc/apache2/sites-available/koha-install.yourdomain.org.conf

sudo nano /etc/apache2/sites-available/koha-install.yourdomain.org.conf

Copy and paste:
# domain: koha-install.yourdomain.org
# public: /var/www/koha-install.yourdomain.org/public_html/

<VirtualHost *:80>
ServerAdmin webmaster@yourdomain.org
ServerName koha-install.yourdomain.org

DirectoryIndex index.html index.php
DocumentRoot /var/www/koha-install.yourdomain.org/public_html

LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Apache2 enable

sudo a2enmod ssl

sudo a2dissite *default

sudo a2ensite yourdomain.org.conf

sudo a2ensite library.yourdomain.org.conf

sudo a2ensite library-intra.yourdomain.org.conf

sudo a2ensite koha-install.yourdomain.org.conf

sudo systemctl restart apache2

Putty PSFTP upload

open debian@your.ip.address

lpwd [C:\Program Files\PuTTY]

pwd [/home/Debian]

One for each page:
cd /var/www/yourdomain.org/public_html/

cd /var/www/library.yourdomain.org/public_html/

cd /var/www/library-intra.yourdomain.org/public_html/

cd /var/www/koha-install.yourdomain.org/public_html/

mkdir images

put -r images

quit

SSL

sudo apt install certbot python3-certbot-apache -y

sudo certbot --apache -d yourdomain.org

sudo certbot --apache -d yourdomain.org -d koha-install.yourdomain.org

sudo certbot --apache -d yourdomain.org -d library.yourdomain.org

sudo certbot --apache -d yourdomain.org -d library-intra.yourdomain.org

SSL auto renew

Use a shell script:
#!/bin/bash

Save the script in the /usr/local/bin directory as something like update_certs to schedule a cron job:
30 0 * * 0 /usr/local/bin/update_certs

Create a snapshot of VPN instance

MariaDB

sudo apt install mariadb-server mariadb-client -y

MySQL security

sudo mysql_secure_installation

Debian extras

sudo apt-get install software-properties-common dirmngr apt-transport-https -y

Koha

sudo apt update

sudo apt-get -y install sudo wget gnupg

sudo wget -q -O- https://debian.koha-community.org/koha/gpg.asc | sudo apt-key add -

sudo apt-get update

echo 'deb http://debian.koha-community.org/koha stable main' | sudo tee /etc/apt/sources.list.d/koha.list

sudo apt-get update

sudo apt-get install koha-common

sudo apt-get install -f

sudo a2enmod rewrite

sudo a2enmod cgi

sudo systemctl restart apache2

Apache2 ports

sudo nano /etc/apache2/ports.conf

Copy and paste:
Listen 80

Copy and paste:
NameVirtualHost *:80

Koha library instance

sudo koha-create --create-db library

Koha plack

sudo a2enmod headers proxy_http

sudo koha-plack --enable library

sudo koha-plack --start library

sudo systemctl restart apache2

Apache2 enable (2)

sudo a2enmod deflate

sudo a2ensite library

sudo systemctl restart apache2

sudo nano /etc/koha/koha-sites.conf
Replace '.myDNSname.org' with yourdomain.org

sudo nano /etc/apache2/sites-available/library.conf
Replace '.myDNSname.org' in #OPAC and #Intranet with yourdomain.org

sudo a2dissite library.yourdomain.org.conf

sudo a2dissite library.yourdomain.org-le-ssl.conf

sudo a2dissite library-intra.yourdomain.org-le-ssl.conf

sudo a2dissite library-intra.yourdomain.org.conf

sudo systemctl restart apache2

Move SSL from library subpages to “library”

Debian: Copy a file

To make a copy of a file called file.doc in the current directory as newfile.doc, enter:
cp file.doc newfile.doc

cp /etc/apache2/sites-available/library.conf /etc/apache2/sites-available/library-le-ssl.conf

Copy contents of:
sudo nano /etc/apache2/sites-available/library.yourdomain.org-le-ssl
sudo nano /etc/apache2/sites-available/library-intra.yourdomain.org-le-ssl

Add SSL content to:
sudo nano /etc/apache2/sites-available/library-le-ssl.conf

Final version:
# Koha instance library Apache config.

# OPAC
<IfModule mod_ssl.c>
<VirtualHost *:443>
<IfVersion >= 2.4>
Define instance "library"
</IfVersion>
Include /etc/koha/apache-shared.conf
# Include /etc/koha/apache-shared-disable.conf
Include /etc/koha/apache-shared-opac-plack.conf
Include /etc/koha/apache-shared-opac.conf

ServerName library.yourdomain.org
SetEnv KOHA_CONF "/etc/koha/sites/library/koha-conf.xml"
AssignUserID library-koha library-koha
ServerAdmin webmaster@yourdomain.org

ErrorLog /var/log/koha/library/opac-error.log
# TransferLog /var/log/koha/library/opac-access.log
SSLCertificateFile /etc/letsencrypt/live/yourdomain.org-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.org-0001/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

# Intranet
<IfModule mod_ssl.c>
<VirtualHost *:443>
<IfVersion >= 2.4>
Define instance "library"
</IfVersion>
Include /etc/koha/apache-shared.conf
# Include /etc/koha/apache-shared-disable.conf
Include /etc/koha/apache-shared-intranet-plack.conf
Include /etc/koha/apache-shared-intranet.conf

ServerAdmin webmaster@yourdomain.org
ServerName library-intra.yourdomain.org
SetEnv KOHA_CONF "/etc/koha/sites/library/koha-conf.xml"
AssignUserID library-koha library-koha

ErrorLog /var/log/koha/library/intranet-error.log
# TransferLog /var/log/koha/library/intranet-access.log
SSLCertificateFile /etc/letsencrypt/live/yourdomain.org-0002/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.org-0002/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>


Copy content:
sudo nano /etc/apache2/sites-available/yourdomain.org-le-ssl.conf

Paste content into:
sudo nano /etc/apache2/sites-available/default-ssl.conf

Final version:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@yourdomain.org
ServerName yourdomain.org
ServerAlias www.yourdomain.org

DirectoryIndex index.html index.php
DocumentRoot /var/www/yourdomain.org/public_html

LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/yourdomain.org-0002/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.org-0002/privkey.pem
</VirtualHost>
</IfModule>

sudo systemctl restart apache2

Debian: Deleting a directory

To remove non-empty directories and all the files within them, use the rm command with the -r (recursive) option:

sudo rm -r dirname

cd /var/www/
Delete:
library.yourdomain.org
library-intra.yourdomain.org

cd /etc/apache2/sites-available/
Delete:
library-intra.yourdomain.org.conf
library-intra.yourdomain.org-le-ssl.conf
library.yourdomain.org.conf
library.yourdomain.org-le-ssl.conf

cd /etc/apache2/sites-enabled/
Delete:
library-intra.yourdomain.org.conf
library-intra.yourdomain.org-le-ssl.conf
library.yourdomain.org.conf
library.yourdomain.org-le-ssl.conf

sudo service memcached restart

sudo systemctl restart apache2

sudo service mariadb restart

Debian: Delete line(s) in Nano

First, you need to press CTRL + Shift + 6 to mark the start of your block.
Now, shift the cursor to the end of the block with the arrow keys, and it will outline the text.
Finally, press CTRL + K to delete a block, and it will remove a line in nano.

Koha Web installer

koha_library
[password]
sudo nano /etc/koha/sites/library/koha-conf.xml

Favicon

Create:
https://www.favicon-generator.org/

Store:
C:\Program Files\PuTTY

Copy and paste:
<head>
<title>Welcome to YourDomain! </title>
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png>
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png>
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png>
<link rel="manifest" href="/images/site.webmanifest">
</head>

Putty PSFTP download

open debian@your.ip.address

lpwd [C:\Program Files\PuTTY

pwd [/home/debian

cd /var/www/yourdomain.org/public_html/

mget -r images

quit

Crontab

sudo apt-get update

sudo apt-get install cron

sudo crontab -e

Copy and paste:
# Koha Example Crontab File
# Author: Joe Atzberger
#
# This is an example of a crontab file for Debian. It may not work
# in other versions of crontab, like on Solaris 8 or BSD, for example.
#
# While similar in structure,
# this is NOT an example for cron (as root). Cron takes an extra
# argument per line to designate the user to run as. You could
# reasonably extrapolate the needed info from here though.
#
# WARNING: These jobs will do things like charge fines, send
# potentially VERY MANY emails to patrons and even debar offending
# users. DO NOT RUN OR SCHEDULE these jobs without being sure you
# really intend to. Make sure the relevant message templates are
# configured to your liking before scheduling messages to be sent.
#
# ENVIRONMENT:
# First, establish Koha's two important ENV variables.

PERL5LIB=/usr/share/koha/lib
KOHA_CONF=/etc/koha/koha-conf.xml

# Some additional variables to save you typing
KOHA_CRON_PATH = /usr/share/koha/bin/cronjobs
#
# MULTIPLE KOHA SUPPORT:
# You can still run jobs for this user's additional koha installs,
# by manipulating those variables in the command.
#
# For example, on the same codebase:
# */10 * * * * __KOHA_USER__ KOHA_CONF=/etc/koha/koha-conf.xml
/usr/share/koha/bin/migration_tools/rebuild_zebra.pl -b -a -z >/dev/null #
# For example, on a separate codebase:
# */10 * * * * __KOHA_USER__ KOHA_CONF=/etc/koha/koha-conf.xml PERL5LIB=/home/koha/kohaclone
/home/koha/kohaclone/misc/migration_tools/rebuild_zebra.pl -b -a -z >/dev/null #
# ADDITIONAL INFO:
# See the perldoc of individual scripts to determine what other options
# are available. Check the man page for crontab to understand the
# schedule syntax for your system.
#
# NOTE: Don't forget to keep the empty line at the bottom.
# Cron/crontab will choke without it.
#
# SCHEDULED JOBS:
# m h dom mon dow user command
#
#
# AUTOMATIC RENEWAL + AUTOMATIC CHECK-IN + FINES + OVERDUE NOTICES
# Sequence is important - renew what can be renewed, check things in if set to, charge fines for the rest, print
fine amount into overdue notices 5 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/automatic_renewals.pl -c; $KOHA_CRON_PATH/automatic_checkin.pl ; $KOHA_CRON_PATH/fines.pl; $KOHA_CRON_PATH/overdue_notices.pl -t
#
# ADVANCE NOTICES
#10 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/advance_notices.pl -c
#
# MEMBERSHIP_EXPIRY NOTICES
#15 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/membership_expiry.pl -c
#
# SERIALS UPDATE
#18 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/serialsUpdate.pl -c
#
# PROCESS LONG OVERDUES
# updates item status from available to longoverdue for items long overdue
# 19 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/longoverdue.pl --lost 90=1 --confirm
#
# SEND EMAILS
#15 * * * * __KOHA_USER__ $KOHA_CRON_PATH/process_message_queue.pl
#
# Hourly holds queue updated
#52 * * * * __KOHA_USER__ $KOHA_CRON_PATH/holds/build_holds_queue.pl >/dev/null 2>&1
#
# Cancel expired holds
#0 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/holds/cancel_expired_holds.pl >/dev/null 2>&1
#
# Auto unsuspend holds
#0 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/holds/auto_unsuspend_holds.pl > /dev/null 2>&1
#
# Update popularity counts for biblio records
#0 2 * * * __KOHA_USER__ $KOHA_CRON_PATH/update_totalissues.pl --commit=1000 --use-stats --incremental --interval=1d >/dev/null 2>&1
#
# ZEBRA INDEX UPDATES with -z option, incremental index updates throughout the day
# for both authorities and bibs
*/10 * * * * __KOHA_USER__ $KOHA_CRON_PATH/../migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
#
# clean up databases nightly. Be sure not to run this with --sessions during a time when the system is in use!
16 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/cleanup_database.pl --confirm --sessions --zebraqueue 10 --list-invites --temp-uploads
#
# delete old purchase suggestions weekly. Replace XX with a number to define the age of suggestions to delete.
#@weekly __KOHA_USER__ $KOHA_CRON_PATH/purge_suggestions.pl --confirm --days XX > /dev/null 2>&1
#
# share_usage_with_koha_community.pl every months
0 0 1 * * __KOHA_USER__ $KOHA_CRON_PATH/share_usage_with_koha_community.pl
#
# run merge authorities
20 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/merge_authorities.pl -b
#
# PLUGIN JOBS
10 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/plugins_nightly.pl

sudo systemctl restart apache2

Koha Web installer › Default data loaded

Mandatory data added
sysprefs.sql
subtag_registry.sql
auth_val_cat.sql
message_transport_types.sql
sample_notices_message_attributes.sql
sample_notices_message_transports.sql
keyboard_shortcuts.sql
auth_values.yml
authorities_normal_marc21.yml
class_sources.yml
marc21_framework_DEFAULT.yml
sample_frequencies.yml
sample_notices.yml
sample_numberpatterns.yml
userflags.sql
userpermissions.sql
audio_alerts.sql
account_offset_types.sql
account_credit_types.sql
account_debit_types.sql

Optional data added
auth_val.yml
csv_profiles.yml
marc21_default_matching_rules.yml
marc21_holdings_coded_values.yml
marc21_relatorterms.yml
marc21_sample_fastadd_framework.yml
marc21_simple_bib_frameworks.yml
parameters.yml
patron_atributes.yml
patron_categories.yml
sample_creator_data.yml
sample_itemtypes.yml
sample_libraries.yml
sample_libraries_holidays.yml
sample_news.yml
sample_quotes.yml
sample_z3950_servers.yml