Mahara supports the LEAP2A standard for importing and exporting data, allowing a user to take their content with them from one Mahara installation and import it into another. Limited interoperability exists between Mahara and other systems supporting the LEAP2A standard also
Mahara is a web application. This means it's not just an executable file you can download and run. You need a server to put it on (you can use your desktop as a server if you're just trialling it). You'll need to install other software for it to run too - such as the Apache web server and PostgreSQL database system. Another alternative is to use shared hosting - but this isn't as good as having a machine where you can have administrator access.
If you're running Debian/Ubuntu, a lot of the required software (and even Mahara itself) can be installed using
apt-get. If you're using some other linux distribution, you may be able to use your distribution specific install tool also.
Mahara is mainly designed for use on Linux, using the Apache web server, PostgreSQL database server and PHP. We also support its use with the MySQL database server.
In addition, members of the community have successfully got Mahara running on Mac OSX and Windows, and have also managed to use nginx instead of Apache. The Mahara developers fix bugs found that prevent running on these platforms, but don't explicitly test them from day to day, so you may have less luck than using a Linux box with Apache.
- CPU: any modern CPU produced in the last few years is fine, the faster the better naturally. PHP pages are CPU limited, so faster CPUs mean quicker response times.
- Memory: 256MB at an absolute minimum. 1G or more is recommended.
- Disk: This will depend largely on how much disk quota you want each user to have. For a site of 1000 users, each with a 250M quota, you might need 50G to start with.
See the scalability article for more information on the hardware required, and how you can calculate how much you need. One modern entry-level server will handle an average school or college quite sufficiently. In many cases, you can get away with a virtual environment such as a VPS.
- Linux - any distribution should be fine, Debian or Ubuntu are recommended as they're most regularly tested on, and even have debian packages.
- PHP - 5.1.3 or greater. You'll need these PHP extensions also.
- PostgreSQL - 8.1+ (recommended), or MySQL 5.0.25+ with InnoDB table support.
- Apache - 1.3 or higher, version 2 or higher recommended
More details about the Software Requirements are available, including what you can substitute for any of them.
Get the code, and put on your webserver
In order for your Mahara to run, you need to put a copy of the code on your own server. You can either download a standard build of Mahara, or check out the project from the git repository if you know how git works (this option is mainly for developers).
Once you have the code, copy the contents of the
htdocs/ directory to your webserver. It is best if you either:
Copy the entire directory, then rename it to something like 'mahara' - so you will see your site at
- Copy the contents of the
htdocs/directory to the top level public directory (often called
public_html) of your webserver, so you can see your site at
If you are unfamiliar with Ubuntu and need an in more detailed explanation about how to install the files and configure Apache, go to the step-by-step guide.
Create the Database
You need to create a database for Mahara and ensure that the webserver is able to connect to it. Instructions for the command line follow, if you have access to a CPanel or similar software you can create the database using it instead.
Your database must be UTF8 encoded. The commands below create a UTF8 encoded database, if you use CPanel etc., then you will have to make sure it creates you a UTF8 database.
Command line instructions for Postgres:
# Run these commands while su'd to the 'postgres' user
# If you need to create a database user:
createuser -SRDP (username)
# Actual database creation
createdb -O (username who will be connecting) -EUTF8 (databasename)
Command line instructions for MySQL:
mysql -Uroot<br />[enter password]<br />create database (databasename) character set UTF8;<br />grant all on (databasename).* to 'username'@'localhost' identified by 'password';
By the way, if possible, try to use PostgreSQL for your database if you can.
Create the Dataroot Directory
This is a directory where Mahara will write files that are uploaded to it, as well as some other files it needs to run. The main point about this directory is that it is one that the web server can write to. The other main point is that it cannot be inside the directory where your Mahara code is! In fact, if you have a public_html directory, it should not be inside that at all.
On your webserver, you will need to make this directory. If you have a public_html directory, make the directory alongside it. You can give it a name like 'maharadata'. Once you are done, you should have this directory structure (ignoring files):
You will need to make the maharadata directory writable by the web server user. You can either change its owner to be the web server user, or you can
chmod it to 777. The latter isn't recommended, but if you're on shared hosting it's what you'll probably have to do. FTP programs will allow you to chmod the directory.
Create Mahara's config.php
In the Mahara htdocs directory is
config-dist.php. You need to make a copy of this called
config.php. You then need to go through the file and make changes where appropriate. The file is commented, and there are not many settings to change. However, take special note of the following settings:
- database connection details — ensure you include the database connection details by inserting the proper values for $cfg->dbname, $cfg->dbuser, $cfg->dbpass, $cfg->dbprefix.
Note: You do not need to set dbprefix, unlike Moodle. Try not using it first, and see if it works. If you find you do need it, you may find it best to leave dbprefix empty and add the prefix directly to $cfg->dbname, $cfg->dbuser values.
dataroot - set this to the filesystem path to the directory you made that the web server user can write to. Please note this is a filesystem path, which on linux will look like
/path/to/your/directoryand on windows will look like
C:\path\to\your\directory. This is NOT a web address such as http://example.org/maharadata!
- directorypermissions - if you're on a server where you do not have root access, you should change this from 0700 to 0777 or similar, so that you can download your dataroot later for backup purposes, and install language packs.
Note: If you're on shared hosting, you probably are not able to change this, so you can ignore this section.
The simplest of Apache VirtualHost configurations will be sufficient:
<VirtualHost *:80><br /> ServerName example.org<br /> DocumentRoot /path/to/mahara/htdocs<br /><br /> ErrorLog /var/log/apache2/mahara.error.log<br /> CustomLog /var/log/apache2/mahara.access.log combined<br /><br /> <Directory /path/to/mahara/htdocs><br /> AllowOverride All<br /> </Directory><br /></VirtualHost>
Please note that your apache configuration should contain no ServerAliases. Mahara expects to be accessed through ONE URL. This gives certainty that cookies are set for the right domain, and also means that SSL certificates for the networking functionality can be generated for this one URL. If you use a server alias, you should expect to see problems like having to log in twice, and potentially SSO between your site and others breaking.
However, you can still make both example.org and www.example.org work for your site, if you use a second VirtualHost directive as well as the one above:
<VirtualHost *:80><br /> ServerName www.example.org<br /> # You _can_ add ServerAliases here if you want more than one URL to<br /> # redirect to your main site<br /> # ServerAlias foo.example.org<br /><br /> Redirect Permanent / http://example.org/<br /></VirtualHost><br />
Run the Web Based Installer
Once you have set up your config.php (and apache configuration, if not on shared hosting), you should now be able to navigate to the Mahara installation using your web browser. This will pop up a page stating the conditions of using Mahara, and will ask for agreement. If you agree with the conditions, click "agree" and Mahara will install itself into your database. Click continue, and you will be asked to change the administrator's password, then you'll be logged in to your new Mahara installation. Congratulations!
Note: The admin's username is 'admin'. Before Mahara 1.2, you will have to log in before you can change your password. The admin's default password is mahara.
What if the installation process breaks with an error?Sometimes this can happen. Normally this is because of some misconfiguration in your system - for example, you haven't granted your database user permission to create tables, or you aren't using a high enough version of your database (see the dependencies). Sometimes, it's because of a bug in the Mahara installer. In order to find out, you will need to check the error log for your webserver. Mahara dumps detailed information in there where a bug occurs.
The message might show you that the problem is with your configuration, but if it looks like a problem with Mahara, you should make a bug report with the information from your logs, so we can fix it.
If you were able to fix the problem, you might need to drop and re-create your database again, so you're starting the installation again without any of the previously installed tables in the way.
Final Task (don't forget!): Cron Job
You will need to set up a cron job to hit htdocs/lib/cron.php every minute. Mahara implements its own cron internally, so hitting cron every minute is sufficient to make everything work.
If you don't set up the cron job, you will find that RSS feeds will not update, and some email notifications won't be sent out, such as forum post notifications.
You can set it up using the command line 'php' command to run the cron script, or by using a command line web browser such as lynx or w3m.
Something like the following in a crontab file will be sufficient:
* * * * * curl http://your-mahara-site.org/lib/cron.php
If you run cron using curl, the cron output will be logged in your apache error log. If you wish to separate where it's logged to away from your apache logs (which is a particularly good idea, though slightly harder to set up), read the separate article about Mahara's cron.
If you liked this article, subscribe to the feed by clicking the image below to keep informed about new contents of the blog: