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 updateInstall 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 -yEdit the PHP configuration file.
$ sudo nano /etc/php/7.4/apache2/php.iniChange 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 = 100MAdd 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 = OffRestart Apache2 service for all changes made to take effect.
$ sudo systemctl restart apache22. Create Mahara Database
Switch to the postgres user.
sudo -i -u postgresCreate a new user maharauser.
createuser -P -D -R -S maharauserCreate a database called mahara and attach maharauser as the owner.
createdb -O maharauser -EUTF8 maharaExit 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.zipUnzip the downloaded file.
$ sudo unzip mahara-21.10.0.zipDelete the downloaded zip file.
$ sudo rm mahara-21.10.0.zipCreate the installation directory /var/www/mahara.
$ sudo mkdir -p /var/www/maharaMove the extracted files to the installation directory.
$ sudo mv mahara-21.10.0/* /var/www/maharaChange ownership of the installation directory.
$ sudo chown -R www-data:www-data /var/www/maharaChange access permissions for the directory.
$ sudo chmod -R 755 /var/www/maharaChange the directory.
$ cd /var/www/mahara/htdocsGenerate a secret salt string.
$ openssl rand -base64 32You 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.phpEdit the configuration file.
$ sudo nano config.phpChange 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.confAdd 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 80Disable Apache default configuration file.
$ sudo a2dissite 000-default.confEnable the new Apache configuration file.
$ sudo a2ensite mahara.confEnable Apache rewrite mode.
$ sudo a2enmod rewriteRestart Apache service.
$ sudo systemctl restart apache25. 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 -eAdd the following line at the end of the file. Save and close the file:
* * * * * php /var/www/mahara/htdocs/lib/cron.php6. 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.