How to install Habari on Centos 7

To install Habari on CentOS 7

Habari is a free and open source publishing platform written in PHP and also has support for MySQL, SQLite and PostgreSQL, which is essential for the database back-end and application framework with a modular, object-oriented Core. Its installation is pretty simple and this tutorial will show you through the step by step installation of Habari in CentOS 7


Installing Habari

For installing Habari, you need to have LAMP stack installed in your system, so ensure their presence in your system. You should also create a database for Habari in your system, so make use of the following command for the same purpose.

[root@server1 Desktop]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with   or g.
Your MariaDB connection id is 14
Server version: 5.5.52-MariaDB MariaDB Server
 
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
 
Type ' help '  or ' h'  for help. Type ' c'  to clear the current input statement.
 
MariaDB [(none)]>  CREATE DATABASE habari 
Query OK, 1 row affected (0.00 sec)
 
MariaDB [(none)]>  CREATE USER ' habariuser' @' localhost'  IDENTIFIED BY ' password'  
Query OK, 0 rows affected (0.05 sec)
 
MariaDB [(none)]>  GRANT ALL PRIVILEGES ON `habari`.* TO ' habariuser' @' localhost'  
Query OK, 0 rows affected (0.04 sec)
 
MariaDB [(none)]>  FLUSH PRIVILEGES 
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]>  exit
Bye


Once done, download the Habari installation package via wget command.

[root@server1 Desktop]# wget http://habariproject.org/dist/habari-0.9.2.zip
--2017-08-18 02:47:12--  http://habariproject.org/dist/habari-0.9.2.zip
Resolving habariproject.org (habariproject.org)... 192.241.163.13
Connecting to habariproject.org (habariproject.org)|192.241.163.13|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3041175 (2.9M) [application/zip]
Saving to: ‘ habari-0.9.2.zip’ 
 
100%[=========================================================================================================================================================================> ] 3,041,175    475KB/s   in 8.2s   
 
2017-08-18 02:47:21 (362 KB/s) - ‘ habari-0.9.2.zip’  saved [3041175/3041175]


After that, you need to create habari directory in /var/www/html/ and extract the downloaded package to it.

[root@server1 Desktop]# mkdir -p /var/www/html/habari
[root@server1 Desktop]# unzip habari-0.9.2.zip -d /var/www/html/habari/
Archive:  habari-0.9.2.zip
  inflating: /var/www/html/habari/README.md  
  inflating: /var/www/html/habari/LICENSE  
&hellip .
&hellip .
&hellip .
 extracting: /var/www/html/habari/system/themes/wazi/content.php  
  inflating: /var/www/html/habari/system/themes/wazi/404.php  
  inflating: /var/www/html/habari/system/themes/wazi/README  
  inflating: /var/www/html/habari/system/themes/wazi/header.php  
  inflating: /var/www/html/habari/system/themes/wazi/home.php


Now, you need to change the ownership for the habari directory as follows.

[root@server1 Desktop]# chown -R apache:apache /var/www/html/habari/


The next step is to create a virtual host configuration file for that the following command can be of help to you.

[root@server1 Desktop]# vim /etc/httpd/conf.d/vhosts.conf


Use the command to make changes to the .conf file

IncludeOptional vhosts.d/*.conf


Create vhosts.d directory and create virtual host configuration file for habari by using the following commands.

[root@server1 Desktop]# mkdir /etc/httpd/vhosts.d/
[root@server1 Desktop]# vim /etc/httpd/vhosts.d/server1.linuxhelp.com.conf


Configure the file as follows.

 < VirtualHost 192.168.7.201:80> 
DocumentRoot " /var/www/html/habari/" 
ServerName server1.linuxhelp.com
ErrorLog " /var/log/httpd/yourdomain.com-error_log" 
CustomLog " /var/log/httpd/yourdomain.com-access_log"  combined
 
< Directory " /var/www/html/habari/" > 
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted
< /Directory> 
< /VirtualHost> 


After the configuration, restart the Apache web server by making use of the following command.

[root@server1 Desktop]# systemctl restart httpd



Open the web browser now and navigate to http://192.168.7.201, the Habari installation page appears.


Back in the terminal, edit the .htaccess file by running the following command.

[root@server1 Desktop]# vim /var/www/html/habari/.htaccess


Add the following lines to the file.

### HABARI START
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
#RewriteBase /
RewriteRule . index.php [PT]
RewriteRule ^(system/(classes|handlers|locale|schema|$)) index.php [PT]
### HABARI END


Database Configuration

Back to the browser. Enter the database information and click on Check Database Connection.


Then, you need to configure your site as you need.


After that, activate the required plugins by clicking on the appropriate check boxes.


Later, edit the config.php file in the box. Finally, click restart installer.

Use the command to open the .php file.

[root@server1 Desktop]# vim /var/www/html/habari/config.php


Add the following lines to the file.

< ?php if ( !defined( ' HABARI_PATH'  ) ) { die( ' No direct access'  )  }
Config::set( ' db_connection' , array(
        ' connection_string' => ' mysql:host=localhost dbname=habari' ,
        ' username' => ' habariuser' ,
        ' password' => ' password' ,
        ' prefix' => ' habari__' 
)) 
 
// Config::set(' locale' , ' en-us' ) 
?> 


In the login page, enter the credentials.


Once logged in, you' ll be taken to the dashboard.

With this, the installation of Habari on CentOS 7 is complete.

Tag : CentOS
FAQ
Q
How can I upload larger files through the Habari silo?
A
Shared hosts often allow you to change PHP's upload_max_filesize parameter in your .htaccess file. Add something like

php_value upload_max_filesize you want to use, to your .htaccess file.
Q
Does using SQLite as my database have any special requirements?
A
SQLite is a single file database that creates temporary files in the directory which contains your database. As a result, your web server must have write access to the directory in which your database exists. If you do not designate a specific directory in your Habari configuration, the default directory in which your database file is created is the directory in which you installed Habari.
Q
Does Habari work with PostgreSQL?
A
Support for PostgreSQL was introduced in version 0.5 of Habari and fixes and improvements continue to be added.
Q
what sites are powered by habari?
A
You can find the lists in "http://wiki.habariproject.org/en/Habari_Powered_Sites"
Q
What are its requirements?
A
LAMP stack where php version is above 5.4 and create mysql db and user for it.