How to install Mahara on Ubuntu

How to install Mahara on Ubuntu

We’ll show you how to install Mahara on Ubuntu. Mahara is a fully featured web application to build your electronic portfolio. You can upload files, create journals, embed social media resources from the web and collaborate with other users in groups. It is fairly easy to install Mahara on an Ubuntu VPS. The installation process should take about 5-10 minutes if you follow the very easy steps described below.

At the time of writing this tutorial, Mahara 16.04.1 is the latest stable version available and it requires:

– Apache web server;
– PHP (version 5.3.6 or higher);
– MySQL(version 5.1 or higher) installed on your Linux VPS;

INSTRUCTIONS:

1. Login to your VPS via SSH

ssh user@vps

2. Update the system

[user]$ sudo apt-get update && sudo apt-get -y upgrade

3. Install MariaDB

To install MariaDB, run the following command:

[user]$ sudo apt-get install -y mariadb-server

4. Create MariaDB database for Mahara

Next, we need to create a database for our Mahara installation.

[user]$ mysql -u root -p

MariaDB [(none)]> CREATE DATABASE mahara character set UTF8;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON mahara.* TO 'maharauser'@'localhost' IDENTIFIED BY 'your-password';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

Do not forget to replace ‘your-password’ with a strong password.

5. Install Apache2 Web Server

Install Apache2 web server

[user]$ sudo apt-get install apache2

6. Install PHP

Install PHP and required PHP modules

To install the latest stable version of PHP version 5 and all necessary modules, run:

[user]$ sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-mysql php5-gd

7. Download and extract Mahara

Download and extract the latest version of Mahara on your server:

[user]$ sudo cd /opt && wget https://launchpad.net/mahara/16.04/16.04.1/+download/mahara-16.04.1.zip
[user]$ sudo unzip mahara-16.04.1.zip
[user]$ sudo mv mahara-16.04.1 /var/www/html/mahara

Create Mahara’s upload directory

[user]$ sudo mkdir /var/www/html/mahara/upload/

8. Configure Mahara

Create Mahara’s config.php

In the Mahara ‘htdocs’ directory there is config-dist.php file. Make a copy of this called config.php.

[user]$ cd /var/www/html/mahara/htdocs/
[user]$ sudo cp config-dist.php config.php

Open the config.php and make the necessary changes where appropriate.

[user]$ sudo nano config.php

$cfg->dbtype   = 'mysql';
$cfg->dbhost   = 'localhost';
$cfg->dbport   = null;
$cfg->dbname   = 'mahara';
$cfg->dbuser   = 'maharauser';
$cfg->dbpass   = 'your-password';
$cfg->dataroot = '/var/www/html/mahara/upload/';

All files have to be readable by the web server, so we need to set a proper ownership

[user]$ sudo chown www-data:www-data -R /var/www/html/mahara/

9. Configure Apache Web Server

Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘mahara.conf’ on your virtual server:

[user]$ sudo touch /etc/apache2/sites-available/mahara.conf
[user]$ sudo ln -s /etc/apache2/sites-available/mahara.conf /etc/apache2/sites-enabled/mahara.conf
[user]$ sudo nano /etc/apache2/sites-available/mahara.conf

Then, add the following lines:

<VirtualHost *:80>
ServerAdmin admin@yourdomain.com
DocumentRoot /var/www/html/mahara/htdocs/
ServerName your-domain.com
ServerAlias www.your-domain.com
<Directory /var/www/html/mahara/htdocs/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/your-domain.com-error_log
CustomLog /var/log/apache2/your-domain.com-access_log common
</VirtualHost>

10. Restart and Verify

Restart the Apache web server for the changes to take effect:

[user]$ sudo service apache2 restart

Open your favorite web browser, navigate to http://your-domain.com/ and if you configured everything correctly the Mahara installer should be starting. You should follow the easy instructions on the install screen inserting the necessary information as requested.

That is it. The Mahara installation is now complete.


Of course you don’t have to install Mahara on Ubuntu if you use one of our Managed Hosting services, in which case you can simply ask our expert Linux admins to install Mahara on Ubuntu, for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install Mahara on Ubuntu, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

1 thought on “How to install Mahara on Ubuntu”

Leave a Comment