Installing Mahara on NetBSD
Mahara is an open-source e-portfolio system that is free to use and is designed to help you create a personalized online portfolio. In this tutorial, we will guide you through the process of installing Mahara on NetBSD.
Prerequisites
Before proceeding with the installation, you need to have the following prerequisites:
- A NetBSD server with root access
- A web server (Nginx or Apache) installed and configured on your NetBSD machine
- PHP and MySQL or MariaDB installed on your NetBSD machine
Step 1: Download Mahara
First, you need to download the latest version of Mahara from the official website. You can do this by running the following command on your NetBSD machine:
$ curl -O https://launchpad.net/mahara/20.04/20.04.1/+download/mahara-20.04.1.tar.gz
Step 2: Install Required PHP modules
Next, you need to install the required PHP modules to run Mahara. Run the following command:
# pkgin update && pkgin -y install php74-mysql php74-curl php74-gd php74-opcache php74-mbstring php74-zlib php74-sockets php74-xmlrpc php74-session php74-json
Step 3: Install Mahara
Extract the downloaded Mahara archive into your web server’s root directory (/var/www/htdocs/ on NetBSD by default).
# tar zxvf mahara-20.04.1.tar.gz -C /var/www/htdocs/
Step 4: Configure Mahara
Create a database for Mahara and configure the database settings in the file ‘config.php’ which resides in the ‘htdocs/config’ directory.
$ mysql -u root -p
> CREATE DATABASE mahara;
> CREATE USER 'mahara'@'localhost' IDENTIFIED BY '<mahara_password>';
> GRANT ALL PRIVILEGES ON mahara.* TO 'mahara'@'localhost' IDENTIFIED BY '<mahara_password>';
> FLUSH PRIVILEGES;
> exit
Now, navigate to the Mahara directory and rename the ‘config-dist.php’ file to ‘config.php’
# cd /var/www/htdocs/mahara/
# cp config-dist.php config.php
Open the ‘config.php’ file using any text editor and modify the following settings:
$cfg->dbtype = 'mysqli';
$cfg->dbhost = 'localhost';
$cfg->dbname = 'mahara';
$cfg->dbuser = 'mahara';
$cfg->dbpass = '<mahara_password>';
Step 5: Configure Apache/Nginx
First, we will create a new Apache configuration file for Mahara.
Run the following command:
# vi /usr/pkg/etc/httpd/conf/mahara.conf
Add the following configuration settings:
# Mahara configuration
Alias /mahara "/var/www/htdocs/mahara"
<Directory "/var/www/htdocs/mahara">
AllowOverride All
Require all granted
</Directory>
# PHP configuration for Mahara
<Directory "/var/www/htdocs/mahara">
php_admin_value open_basedir "/var/www/htdocs/mahara:/tmp:/var/tmp/:/usr/pkg/share/certs/:/var/pkg/etc/httpd/"
php_admin_value session.save_path "/tmp"
</Directory>
DirectoryIndex index.php
Save and Exit the file.
For Nginx add following configuration settings:
server {
listen 80;
server_name mahara.example.net;
root /var/www/htdocs/mahara;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_VALUE "open_basedir=/var/www/htdocs/mahara:/tmp:/var/tmp/:/usr/pkg/share/certs/:/var/pkg/etc/httpd/
session.save_path=/tmp";
}
}
Save and Exit the file.
Step 6: Restart Web server
Once you have configured Apache (or Nginx), save and exit the configuration file, and restart the web server to apply the changes.
# service apache24 restart
or
# service nginx restart
Step 7: Accessing Mahara
Open a web browser and go to the following URL:
http://localhost/mahara
Or
http://mahara.example.net
You should be able to see the Mahara website, and you can now create a new account or log in to your existing account to start using the e-portfolio system.
Congratulations! You have successfully installed Mahara on NetBSD.