That very popular database server is available with majority of Linux distributions. If, however, you have to install it yourself, start with downloading its sources from www.mysql.com.
After extracting, go to directory with MySQL and type this 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 new_password
You have to create database if you run LMS for the first time. If you are upgrading from older version, look into Changelog for appropriate notes about database changes. In order to create database and load it with schema go to LMS directory and run:
mysql -u[user name with database creation rights] -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 '[your_password]'; mysql> flush privileges; mysql> use lms; mysql> source doc/lms.mysql;
Because MySQL is default database for LMS, configuration is limited to [database] section setup. Thus you need to edit /etc/lms/lms.ini and fill in password and user's name:
user = lms password = your_password
After this step you should be able to enter your system without any problems. Just write an URL for your LMS installation. If there's no user account (first run), you'll be prompted with form to add username and some personal data. When you enter correct admin personal details LMS will move you to login page, where you can use newly created account.
Let's stop here and 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 mysql database backup automagically each 3, 10, 17, 21 and 28 day of month at 4:12 at night.
LMS is tested on PostgreSQL 7.3.4 and higher, but because none of special features of the engine are ever used, there should be no problems with its later versions. If you have not installed PostgreSQL server, best solution is to compile it yourself from sources available on www.postgresql.org.
That is a short version of installation procedure, more info can be found in Postgres documentation. After you download and extract sources 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 --locale=pl_PL.UTF-8 $ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
While server is running you can start with adding database and its owner, both named 'lms' and loading database schema:
$ /usr/local/pgsql/bin/createuser -d -A -P lms $ /usr/local/pgsql/bin/createdb -E UNICODE -U lms lms $ /usr/local/pgsql/bin/psql -d lms -U lms -f /lms/doc/lms.pgsql
For LMS default database server is MySQL so you have to set following options in [database] section of /etc/lms/lms.ini file:
type = postgres user = lms password = password_entered_with_lms_user_creation
![]() | The need for password actually depends on Postgres users authentication configuration found in /usr/local/pgsql/data/pg_hba.conf (refer to Postgresql documentation). By default password is not required and you can comment it with semicolon. |
After this step you should be able to enter your system without any problems. Just write an URL for your LMS installation. If there's no user account (first run), you'll be prompted with form to add username and some personal data. When you enter correct admin personal details LMS will move you to login page, where you can use newly created account.
Let's stop here and add some stuff to cron, for peace of mind:
12 4 3,10,17,21,28 * * /usr/bin/pg_dump -U lms --clean --create --column-inserts \ --format=p lms -- file backups/lms-auto-"$(date +%s)".sql
This one-file database is superior for its speed. Quoting its authors it might be 2-3 times faster than MySQL, and with proper configuration it's possible to load the whole data into RAM, which has high positive impact on performance. Below is short description of installation. Sources can be downloaded from: www.sqlite.org.
Here You can see how to install the SQLite libraries and add extension to your PHP installation (PHP 5.0 has SQLite built in). After you unpack the sources go to SQLite directory and type in commands step by step (for example):
$ ./configure --enable-utf8 $ make $ make install $ ldconfig $ pear download http://pecl.php.net/get/SQLite-1.0.2.tgz $ pear install SQLite-1.0.2.tgzNext in php.ini set:
extension=sqlite.soThere is an option to compile-in SQLite PHP extension: --with-sqlite.
You will need to create your database and fill it with initial schema before using LMS for the first time. Go to your 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.db
Second method of database creation (if you haven't got any SQLite client application) is use of LMS module named sqlite_createdb.php from sample directory. First configure LMS (see below), then go to LMS source tree and run:
# php sample/sqlite_createdb.php
One of the SQLite limitations is that it doesn't authenticate users, so the only configuration options you have to setup are type and path to the database file. In [database] section of /etc/lms/lms.ini file set:
type = sqlite database = /usr/local/lms/lms.db
After this step you should be able to enter your system without any problems. Just write an URL for your LMS installation. If there's no user account (first run), you'll be prompted with form to add username and some personal data. When you enter correct admin personal details LMS will move you to login page, where you can use newly created account.