2.4. Database Server Installation

2.4.1. MySQL

2.4.1.1. Intro

That very popular database is available with majority of Linux distributions. If however you must install it independently, begin from sources downloading from www.mysql.com.

2.4.1.2. MySQL Server Installation

After extracting, go to directory with MySQL and type sequence of commands:

$ ./configure --prefix=/usr/local/mysql
$ make
$ make install
$ /usr/local/mysql/bin/mysql_install_db
$ chown mysql -R /usr/local/mysql/var
$ /usr/local/mysql/bin/safe_mysqld &
$ /usr/local/mysql/bin/mysqladmin -u root password nowe_hasło

2.4.1.3. Create Database

It is necesserily if you run LMS at the FIRST time. If you are upgrading LMS from older version, appropriate notes what to do with database stands in ChangeLog file. So, go to directory, in which you've got LMS and run mysql's shell:

mysql -u[here enter user with full access rights to database] -p
Enter password:[just enter password:)]
mysql> create database lms;
mysql> grant usage on lms.* to lms@localhost;
mysql> grant select,insert,update,delete,create,alter on lms.* to lms@localhost identified by 'haslo';
mysql> flush privileges;
mysql> use lms;
mysql> source doc/lms.mysql;

2.4.1.4. LMS Configuration (lms.ini)

Because MySQL is default database for LMS, configuration is limited for setting in section [database] of file /etc/lms/lms.ini password and user's name:

user     = lms
password = your_password

After that, if LMS can establish connection to database server, it is possible get to the system without problems. If in database is no such administrator account, only thing what you'll see be form of administrator addition. When you enter correct admin personal details, LMS will move you to login page, where at once you can use newly created account.

Let's stop here, add some stuff to cron, for peace of mind:

12 4 3,10,17,21,28 * * /usr/bin/mysqldump -u lms --password=your-super-secret-password \
              --add-drop-table --add-locks lms > backups/lms-auto-"$(date +%s)".sql

That will create at 4:12 morning, every 3, 10, 17, 21 and 28 day of month automagic mysql database backup.

2.4.2. PostgreSQL

2.4.2.1. Intro

LMS is tested on PostgreSQL 7.3.4 and higher, but because special properties of that base are not used, there will be no problem with later versions. If you have not instaled PostgreSQL server, best solution will be selfhand compilation from sources available on www.postgresql.org.

2.4.2.2. Instalacja

That is a short version of installation procedure, more info can be find in postgres documentation. After download and extraction go to main directory and run following commands:

$ ./configure --enable-locale
$ gmake
$ su
$ gmake install
$ adduser postgres
$ mkdir /usr/local/pgsql/data
$ chown postgres /usr/local/pgsql/data
$ su - postgres
$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
$ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &

2.4.2.3. Database Creation

While server is running you can enter finto creation of database with name 'lms', which owner will be user with login 'lms'.

$ /usr/local/pgsql/bin/createuser -d -A -P lms
$ /usr/local/pgsql/bin/createdb -E LATIN2 -U lms lms
$ /usr/local/pgsql/bin/psql -d lms -U lms -f /lms/doc/lms.pgsql

2.4.2.4. LMS Configuration (lms.ini)

For LMS default database server is MySQL, so in section [database] of file /etc/lms/lms.ini you must set following options:

type     = postgres
user     = lms
password = password_entered_while_user_lms_account_creation

Note

Password's demand depends on configuration of postgres users autentication in /usr/local/pgsql/data/pg_hba.conf. By default password is not required.

After that, if LMS connects to database, you can without problems enter to the system. If in database will be not administrator's account, only thing what you'll see will be form of administrator's account addition. When you enter correct data LMS will move you to login page, when you can use newly created account.

2.4.3. SQLite

2.4.3.1. Intro

This one-file database is commend for speed. Authors define that it is 2-3 times faster than MySQL. Furthermore, with properly configuration it's possible to load whole database in to the RAM menory, during this the efficiency highly increases. Below is short description of installation. Sources can be downloaded from: www.sqlite.org.

2.4.3.2. Instalacja SQLite

Here You can see how to install the SQLite libraries and adding this service to PHP database (in PHP 5.0 ver. have SQLite built in). After unpacking sources go to SQLite directory and type in Commands step by step (for example):

$ ./configure
$ make
$ make install
$ ldconfig
$ pear download http://pecl.php.net/get/SQLite-1.0.2.tgz
$ pear install SQLite-1.0.2.tgz
Next in php.ini set:
extension=sqlite.so
There is option to compile-in SQLite into PHP : --with-sqlite.

2.4.3.3. Database Creation

It's necessarily when You running LMS FIRST TIME! Go to Yours LMS directory and run SQlite shell:

$ sqlite -init doc/lms.sqlite /usr/local/lms/lms.db
sqlite> .exit
$ chown 99.98 /usr/local/lms/lms

2.4.3.4. LMS Configuration (lms.ini)

One of the SQLite limits is no authenticity of users, that's why configuration request only setting type and path to the database file. In section [database] pliku /etc/lms/lms.ini set:

type     = sqlite
database = /usr/local/lms/lms.db

Now we can get in to the system. But if in Database is no user account, we will see add user account form.