System Administrator's Guide/Installing Mahara/How to install Mahara in Ubuntu
From Mahara Wiki
< System Administrator's Guide | Installing Mahara
If you are unfamiliar with Linux in general, and Debian-based distributions in particular, this guide will show you how to proceed, in addition to the "Installing Mahara" document.
This guide is just for installing a development site of Mahara as a localhost. For a production site, you would read the complete "Ubuntu Server Guide" documentation.
These instructions assume that you're running a fresh installation of Ubuntu 11.10 or similar.
Install Required Packages
sudo apt-get install apache2 php5 postgresql-9.1 php5-gd php5-pgsql php5-xmlrpc php5-curl php5-mbstring
This should install all the dependencies we need.
After installing the packages, just follow the instructions provided in the "Installing Mahara" main document to unzip and install the Mahara folders.
Download and unpack Mahara
In this example, we install mahara to /srv/www/[hostname], and store our data in /srv/data/[hostname].
cd /srv/ mkdir data www cd www wget http://launchpad.net/mahara/1.4/1.4.0/+download/mahara-1.4.0.zip unzip mahara-1.4.0.zip rm mahara-1.4.0.zip mv mahara-1.4.0 [hostname]
Configure the Database
The easiest way to create the database is to switch to the postgres user.
We'll create a new user (mahara), and also a new database (also mahara).
sudo su - postgres createuser -SRDP mahara [password] [confirm password] createdb -O mahara -EUTF8 mahara exit
Configure Apache2
The next step is to add your Mahara site as a new virtual hosts. There are many ways of doing so but this is the most straight forward:
- Create a new file called "mahara.conf" (for instance) at /etc/apache2/sites-available.
- You need to edit that file by typing from the console:
sudo gedit /etc/apache2/sites-available/mahara.conf
(or alternatively "sudo nano /etc/apache2/sites-available").
The following is a very basic example of an Apache configuration for Mahara. You'll need to put this into the mahara.conf file you just opened
<VirtualHost *:80> ServerName [hostname] DocumentRoot /srv/www/[hostname/htdocs <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /srv/www/[hostname]/htdocs/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/error.log CustomLog /var/log/apache2/access.log combined </VirtualHost>
We'll then need to enable the site. On Ubuntu, Apache comes with a suite of commands for doing this kind of thing. We'll use the Apache2 Enable Site command:
sudo a2ensite mahara.conf
DNS/Friendly Name
Depending on what you chose as your host name, you may need to add a DNS entry, or a line to the /etc/hosts file.
In this example, I'm running mahara on my local system for development/demonstration purposes. I don't have proper DNS available so I'm adding my mahara.local domain.
sudo gedit /etc/hosts
And add:
127.0.0.1 [hostname]
Mahara Configuration
The next step is to create the config.php from the config-dist.php. This step is pretty well explain at the "Mahara Configuration", but essentialy we'll
cd /srv/www/[hostname]/htdocs sudo cp config-dist.php config.php sudo gedit config.php
The key items to set are:
- $cfg->wwwroot
- $cfg->dataroot
- $cfg->dbname
- $cfg->dbuser
- $cfg->dbpass
If you've followed the steps so far, the following should work
<?php
$cfg = new stdClass();
$cfg->wwwroot = 'http://[hostname]';
$cfg->dataroot = '/srv/data/[hostname]';
$cfg->dbname = 'mahara';
$cfg->dbuser = 'mahara';
$cfg->dbpass = '[password]';
We'll need to make sure that the web server can write to the data directory (dataroot). To do this, we'll change who owns the directory with the chown command. Apache2 typically runs as the user 'www-data' on Debian and Ubuntu:
sudo chown -R www-data:www-data /srv/data/[hostname]
There is a very good-and short-tutorial about how to change permissions and groups of users in Ubuntu by using the chmod command. It only takes 10 minutes to read it and it really gives you a good insight.
Install Mahara
You should now be ready to actually install Mahara. Open your browser of choice, and visit the site (e.g. http://[hostname])
After checking you're ready to proceed, Mahara will install and ask for an e-mail address and password for your admin user.