Knowledgebase

Install Mahara on Ubuntu 20.04 Print

  • 0

Introduction

Mahara is a free and open-source web-based application used for building and managing an electronic portfolio. It's scalable, customizable, and can be personalized to suit your needs. A user-friendly design and responsive mobile application access enable collaboration within academic institutions to offer a platform to create personal and professional learning and development environment. This article explains how to install Mahara on Ubuntu 20.04.

Prerequisites

1. Install LAMP Server

Update system package list.

$ sudo apt update

Install PHP 7.4 and more modules.

$ sudo apt install apache2 postgresql postgresql-contrib php7.4 libapache2-mod-auth-pgsql libapache2-mod-php7.4 php7.4-pgsql php7.4-json php7.4-common php7.4-gmp php7.4-curl php7.4-opcache php7.4-intl php7.4-fpm php7.4-xmlrpc php7.4-bcmath php7.4-zip php7.4-mbstring php7.4-gd php7.4-cli php7.4-xml php7.4-zip wget unzip poppler-utils -y

Edit the PHP configuration file.

$ sudo nano /etc/php/7.4/apache2/php.ini

Change the following values. To search for a specific line, use Control+W, enter search phrase then press Enter.

upload_max_filesize = 50M
post_max_size = 100M

Add the following directives to the end of the file. Now save and close the file:

register_globals = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
magic_quotes_gpc = Off
allow_call_time_pass_reference = Off

Restart Apache2 service for all changes made to take effect.

$ sudo systemctl restart apache2

2. Create Mahara Database

Switch to the postgres user.

sudo -i -u postgres

Create a new user maharauser.

createuser -P -D -R -S maharauser

Create a database called mahara and attach maharauser as the owner.

createdb -O maharauser -EUTF8 mahara

Exit Postgres shell.

exit;

3. Install Mahara

Download the latest stable version of Mahara, to find more updated versions in the future, please visit official download page.

$ wget https://launchpad.net/mahara/21.10/21.10.0/+download/mahara-21.10.0.zip

Unzip the downloaded file.

$ sudo unzip mahara-21.10.0.zip

Delete the downloaded zip file.

$ sudo rm mahara-21.10.0.zip

Create the installation directory /var/www/mahara.

$ sudo mkdir -p /var/www/mahara

Move the extracted files to the installation directory.

$ sudo mv mahara-21.10.0/* /var/www/mahara

Change ownership of the installation directory.

$ sudo chown -R www-data:www-data /var/www/mahara

Change access permissions for the directory.

$ sudo chmod -R 755 /var/www/mahara

Change the directory.

$ cd /var/www/mahara/htdocs

Generate a secret salt string.

$ openssl rand -base64 32

You should get a string that resembles the bellow output:

k0Gkq7tHJYj67bDkJHwmLghuk/AlLkiIIVJR3lbcNG0=

Copy the default configuration file to config.php.

$ sudo cp config-dist.php config.php

Edit the configuration file.

$ sudo nano config.php

Change the following lines and define database settings, data directory and secrets. Change the value SecurePassword with the password you set in Step 2 during user creation. Save and close the file.:

$cfg->dbtype   = 'postgres';
$cfg->dbhost   = 'localhost';
$cfg->dbport   = null; // Change if you are using a non-standard port number for your database
$cfg->dbname   = 'mahara';
$cfg->dbuser   = 'maharauser';
$cfg->dbpass   = 'SecurePassword';
$cfg->dataroot = '/var/www/mahara/data';
$cfg->passwordsaltmain = 'k0Gkq7tHJYj67bDkJHwmLghuk/AlLkiIIVJR3lbcNG0=';
$cfg->urlsecret = 'MySuperSecret';

4. Configure Apache2

Create an Apache virtual host configuration file named mahara.conf.

$ sudo nano /etc/apache2/sites-available/mahara.conf

Add the following code to the file. Save and close the file.

<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
DocumentRoot /var/www/mahara/htdocs/

    <Directory /var/www/mahara/htdocs>
        DirectoryIndex index.php
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/mahara_error.log
    CustomLog ${APACHE_LOG_DIR}/mahara_access.log combined

</VirtualHost>

Enable port 80.

$ sudo ufw allow 80

Disable Apache default configuration file.

$ sudo a2dissite 000-default.conf

Enable the new Apache configuration file.

$ sudo a2ensite mahara.conf

Enable Apache rewrite mode.

$ sudo a2enmod rewrite

Restart Apache service.

$ sudo systemctl restart apache2

5. Set up a Cron Job

Set up a Cron job to hit htdocs/lib/cron.php every minute in order to update the RSS feeds and send email notifications.

$ sudo crontab -e

Add the following line at the end of the file. Save and close the file:

* * * * * php /var/www/mahara/htdocs/lib/cron.php

6. Access Mahara Web Interface

To access the Mahara Web Interface, go to your browser and visit http://Server_IP/. For example:

http://192.0.2.10/

Conclusion

You have installed Mahara on your Ubuntu 20.04 server. Continue with the installation wizard screen to complete installation by connecting to the database you created and setting up an administrator account.

More Information

To learn more about how to use Mahara, go to the official documentation page.

Introduction Mahara is a free and open-source web-based application used for building and managing an electronic portfolio. It's scalable, customizable, and can be personalized to suit your needs. A user-friendly design and responsive mobile application access enable collaboration within academic institutions to offer a platform to create personal and professional learning and development environment. This article explains how to install Mahara on Ubuntu 20.04. Prerequisites Deploy a fully updated Rcs Ubuntu 20.04 Server. Create a non-root user with sudo access. 1. Install LAMP Server Update system package list. $ sudo apt update Install PHP 7.4 and more modules. $ sudo apt install apache2 postgresql postgresql-contrib php7.4 libapache2-mod-auth-pgsql libapache2-mod-php7.4 php7.4-pgsql php7.4-json php7.4-common php7.4-gmp php7.4-curl php7.4-opcache php7.4-intl php7.4-fpm php7.4-xmlrpc php7.4-bcmath php7.4-zip php7.4-mbstring php7.4-gd php7.4-cli php7.4-xml php7.4-zip wget unzip poppler-utils -y Edit the PHP configuration file. $ sudo nano /etc/php/7.4/apache2/php.ini Change the following values. To search for a specific line, use CONTROL+W, enter search phrase then press ENTER. upload_max_filesize = 50M post_max_size = 100M Add the following directives to the end of the file. Now save and close the file: register_globals = Off magic_quotes_runtime = Off magic_quotes_sybase = Off magic_quotes_gpc = Off allow_call_time_pass_reference = Off Restart Apache2 service for all changes made to take effect. $ sudo systemctl restart apache2 2. Create Mahara Database Switch to the postgres user. sudo -i -u postgres Create a new user maharauser. createuser -P -D -R -S maharauser Create a database called mahara and attach maharauser as the owner. createdb -O maharauser -EUTF8 mahara Exit Postgres shell. exit; 3. Install Mahara Download the latest stable version of Mahara, to find more updated versions in the future, please visit official download page. $ wget https://launchpad.net/mahara/21.10/21.10.0/+download/mahara-21.10.0.zip Unzip the downloaded file. $ sudo unzip mahara-21.10.0.zip Delete the downloaded zip file. $ sudo rm mahara-21.10.0.zip Create the installation directory /var/www/mahara. $ sudo mkdir -p /var/www/mahara Move the extracted files to the installation directory. $ sudo mv mahara-21.10.0/* /var/www/mahara Change ownership of the installation directory. $ sudo chown -R www-data:www-data /var/www/mahara Change access permissions for the directory. $ sudo chmod -R 755 /var/www/mahara Change the directory. $ cd /var/www/mahara/htdocs Generate a secret salt string. $ openssl rand -base64 32 You should get a string that resembles the bellow output: k0Gkq7tHJYj67bDkJHwmLghuk/AlLkiIIVJR3lbcNG0= Copy the default configuration file to config.php. $ sudo cp config-dist.php config.php Edit the configuration file. $ sudo nano config.php Change the following lines and define database settings, data directory and secrets. Change the value SecurePassword with the password you set in Step 2 during user creation. Save and close the file.: $cfg->dbtype = 'postgres'; $cfg->dbhost = 'localhost'; $cfg->dbport = null; // Change if you are using a non-standard port number for your database $cfg->dbname = 'mahara'; $cfg->dbuser = 'maharauser'; $cfg->dbpass = 'SecurePassword'; $cfg->dataroot = '/var/www/mahara/data'; $cfg->passwordsaltmain = 'k0Gkq7tHJYj67bDkJHwmLghuk/AlLkiIIVJR3lbcNG0='; $cfg->urlsecret = 'MySuperSecret'; 4. Configure Apache2 Create an Apache virtual host configuration file named mahara.conf. $ sudo nano /etc/apache2/sites-available/mahara.conf Add the following code to the file. Save and close the file. ServerAdmin admin@example.com ServerName example.com DocumentRoot /var/www/mahara/htdocs/ DirectoryIndex index.php Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted ErrorLog ${APACHE_LOG_DIR}/mahara_error.log CustomLog ${APACHE_LOG_DIR}/mahara_access.log combined Enable port 80. $ sudo ufw allow 80 Disable Apache default configuration file. $ sudo a2dissite 000-default.conf Enable the new Apache configuration file. $ sudo a2ensite mahara.conf Enable Apache rewrite mode. $ sudo a2enmod rewrite Restart Apache service. $ sudo systemctl restart apache2 5. Set up a Cron Job Set up a Cron job to hit htdocs/lib/cron.php every minute in order to update the RSS feeds and send email notifications. $ sudo crontab -e Add the following line at the end of the file. Save and close the file: * * * * * php /var/www/mahara/htdocs/lib/cron.php 6. Access Mahara Web Interface To access the Mahara Web Interface, go to your browser and visit http://Server_IP/. For example: http://192.0.2.10/ Conclusion You have installed Mahara on your Ubuntu 20.04 server. Continue with the installation wizard screen to complete installation by connecting to the database you created and setting up an administrator account. More Information To learn more about how to use Mahara, go to the official documentation page.

Was this answer helpful?
Back

Powered by WHMCompleteSolution