Tuesday 12 February 2013

Installing Mahara in CentOS, RHEL 6.3



First of all, mahara is a web application to build a eportfolio system. And I think most of you should know what mahara is therefore, I won't be explaining each and everything and instead going directly to Installation process.

Installation Process either in REHLor CentOS or Fedora but it will be similar to debian and ubuntu version as well

  • First we install LAMP or Apache, MySQL and PHP. I won't be going to installation of apache server, you can go to my blog where I have shown apache installation.
LAMP or Apache Server installtion
  • Now we need to remember to most up-to-date system
# yum update
  • Now, we can install git, there are other various ways to download and install but I would prefer to install via git
# cd /tmp
# yum install -y git
  •  Now, that's done we can begin download mahara
# git clone git://gitorious.org/mahara/mahara.git
# cd mahara
# git checkout -t origin/1.4_STABLE
  • Now, we need to copy files that are inside of htdocs to /var/www/html. And honestly, it doesn't need to be in /var/www/html, it can be anywhere but within your document root.
# cp -varpf htdocs /var/www/html
# cd /var/www/html
# mv htdocs mahara
  • So, now we have mahara folder in /var/www/html. Go inside the mahara folder and copy config-dist.php to config.php
# cd mahara

# cp config-dist.php config.php
  •  Use your favorite editor to edit the config.php file. I usually use VIM or gedit. And modify only in places where you see RED colour is highlighted. As, you can see, I am using MySQL but you can use PostgreSQL. Dataroot is where the mahara will be storing the data therefore, we can create it once we have modified and we know which name to use. I have used maharadata.

  •  Lets create a maharadata folder and change ownership to apache:apache (that's for Redhat and for Debian it should be www-data:www-data)
    # mkdir /var/www/maharadata
    # chown apache:apache /var/www/maharadata
  • Please dont' forget to create a database that use UTF8 character set. You can create it during installation of MySQL or now it doesn't really matter but I prefer it this way cause, I learned it this way. :)
# mysql -u root -p
# your-password
mysql> CREATE DATABASE mahara DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
mysql> GRANT ALL PRIVILEGES ON mahara.* to 'root'@'localhost' IDENTIFIED BY 'yourpassword';  
mysql> FLUSH PRIVILEGES;
mysql> quit
# vim config.php
// MAHARA CONFIGURATION FILE
//
// Copy this file from config-dist.php to config.php, and change the values in
// it to suit your environment.
//
// Information about this file is available on the Mahara wiki:
// http://wiki.mahara.org/System_Administrator's_Guide/Installing_Mahara#Create_Mahara's_config.php
//
$cfg = new StdClass;
// database connection details
// valid values for dbtype are 'postgres8' and 'mysql5'
$cfg->dbtype = 'mysql5';
$cfg->dbhost = 'localhost';
$cfg->dbport = null;
$cfg->dbname = 'mahara';
$cfg->dbuser = 'root';
$cfg->dbpass = 'xxxxxxx';

// This path must be writable by the webserver and outside document root (the
// place where the Mahara files like index.php have been installed).
// Mahara will NOT RUN if this is inside your document root, because
// this is a big security hole.
$cfg->dataroot = '/var/www/maharadata';
$cfg->wwwroot = 'http://localhost/mahara/';
  • Now, just restart both httpd and mysqld servers and the browse localhost/mahara 
# /etc/init.d/httpd restart
# /etc/init.d/mysqld restart
Troubleshooting in case error
  • Most probably it should work and in case if your getting following error stating
                      Mahara: Site Unavailable
  • Then that basically means that the server is not being able to find data root maharadata. I would suggest you to create a another directory first, give permission then change the dataroot. I think this way it should perfectly work.
Main Installation of Mahara
  • Now I am pretty sure everyone can follow from there and its fairly simple, few clicks and everything will be up and running. 




3 comments:

  1. i followed above tutorial on ubuntu 12 .but localhost/mahara unvailable.I put mahara folder inside the var/www/html.Seems like it is not pointed to it.any help?

    ReplyDelete
  2. Same Failure I'm facing in centos 6.4. Even after updating Mahara Latest version. Please Help me..

    ReplyDelete
  3. Can you please tell me where you're actually getting stuck

    ReplyDelete