System Administrator's Guide/Installing Mahara/How to install Mahara in Ubuntu

From Mahara Wiki

< System Administrator's Guide‎ | Installing Mahara
Revision as of 17:46, 12 May 2011 by WikiSysop (talk | contribs)

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.

During the installation process of Ubuntu 9.04, you should have had the option of installing a lamp server for local web development, but if not, the instructions are pretty simple. From the console, just type:

  sudo apt-get install apache2 php5 mysql-server-5.0 phpmyadmin

Hopefully, this will install all the dependencies we need. Phpmyadmin is not strictly needed to run your Mahara development site, but will allow you to check the database structure of Mahara. you can launch phpmyadmin by typing in your browser: localhost/phpmyadmin.

After we are sure that we have a lamp server platform installed, just follow the instructions provided in the "Installing Mahara" main document to unzip and install the Mahara folders.  As we are using MySQL as database, you can create the Mahara database directly in phpmyadmin. Remember to choose "utf8_general_ci" as a codification standard.

The next step is to add your Mahara site as a new virtual hosts. There are many ways of doing so. This way will allow you to practice some Ubuntu commands (but if you are really desperate for time, there is a fastest way at the end of the explanation):

  1. Create a new file called "mahara.conf" (for instance) at /etc/apache2/sites-available.
  2. 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").

3.It is in this file where we are going to copy and paste the "Virtual Host" bit in the main instructions that you don't know what to do with. You need to customize that file with the values for your installation, in my case:

        DocumentRoot /home/mcgarcia/mahara

        ErrorLog /var/log/apache2/mahara-1-2-alpha.error.log
        CustomLog /var/log/apache2/mahara-1-2-alpha.access.log combined

One we have added a this new virtual host, we need to link it with the repertoir of  virtualhost that Apache looks, which is in the folder "sites-enabled". So we go to that folder and create the link to the new host:

$cd /etc/apache2/sites-enabled/

 $sudo ln -s /etc/apache2/sites-available/mahara.conf mahara conf

And here comes the fastest way of enabling a new virtual host, just typing:

sudo a2ensite mahara.conf

4. You need to add the domain that you have choosen for your servername as a localhost domain, by editing the /etc/hosts file:

 sudo gedit /etc/hosts

In that file, make sure that you got the line:  localhost  yourmaharadomain (in my case:

which, hopefully, will tell Ubuntu: don't go online everytime that I type that domain in my browser, as it corresponds to a localhost address).

5.  Then,  restart (or reload) Apache:

sudo /etc/init.d/apache2 restart

The next step is to create the config.php from the config-dist.php. This step is pretty well explain at the "Mahara Configuration" secction of the installation guide, so we are not going to repeat it here. If it is of any help, here is how I configured my paths to the wwwroot and the dataroot:

$cfg->wwwroot = '';

$cfg->dataroot = '/home/mcgarcia/maharadata';

Even for a development site, you need to make sure that the dataroot folder-maharadata-is writable for webserver user. If not, Mahara will tell you.

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.

Once the dataroot folder permissions have been set up correctly, we are going to launch the installer by going to the web browser and typing the url of virtual host.

It looks like... it is working? Then, Mahara tells you that you need to install some php extensions. In may case, they were the gd and curl extensions, so I typed from console:

 sudo apt-get install php5-gd

  sudo apt-get install php5-curl

and don't forget to reload apache after that.

Once all the required extensions have been installed, Mahara will start installing the core components.