Install Habari on a CentOS 7 VPS
Habari is a free and open source publishing platform and application framework with a modular, object-oriented Core. In this guide we will install Habari on a CentOS 7 VPS with Apache, MariaDB and PHP. Its installation is pretty easy and straightforward.
To start the installation of Habari, log in to your server as user root:
and as usual, run the following command to make sure that all packages on your CentOS 7 VPS are up to date:
yum -y update
Now, we will install Apache web server:
yum install httpd
Once it is installed, start Apache and set it to start on system start up:
systemctl start httpd systemctl enable httpd
Habari is PHP based application, so we will install PHP among with few PHP modules required by the application:
yum -y install php php-pdo php-common php-mbstring php-gd php-mysql
Habari requires already created empty database. It supports multiple database backends but in this tutorial we will install and use MariaDB. Run the following commands to install MariaDB on your server:
yum install mariadb mariadb-server
Start the MariaDB server and enable it to start on system start up:
systemctl start mariadb systemctl enable mariadb
mysql_secure_installation script to secure the database server and set your MariaDB root password.
Now, log in to the MariaDB server using user ‘root’ and create new database and user for Habari:
mysql -u root -p CREATE DATABASE habari; CREATE USER 'habariuser'@'localhost' IDENTIFIED BY 'PASSWORD'; GRANT ALL PRIVILEGES ON `habari`.* TO 'habariuser'@'localhost'; FLUSH PRIVILEGES; exit
Don’t forget to replace ‘PASSWORD’ with an actual strong password.
Go to Habari’s official website and download the latest stable version of the application. At the moment of writing this article it is version 0.9.2.
Create a directory for Habari’s installation and unpack the zip arhive to the document root directory on your server:
mkdir -p /var/www/html/habari yum -y install unzip unzip habari-0.9.2.zip -d /var/www/html/habari/
Change the ownership of the ‘/var/www/html/habari/’ directory:
chown -R apache:apache /var/www/html/habari/
Create Apache virtual host for your website. First create ‘/etc/httpd/conf.d/vhosts.conf’ file with the following content:
vim /etc/httpd/conf.d/vhosts.conf IncludeOptional vhosts.d/*.conf
and create the virtual host:
mkdir /etc/httpd/vhosts.d/ vim /etc/httpd/vhosts.d/yourdomain.com.conf <VirtualHost YOUR_SERVER_IP:80> ServerAdmin [email protected] DocumentRoot "/var/www/html/habari/" ServerName yourdomain.com ServerAlias www.yourdomain.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>
Restart the Apache web server for the changes to take effect:
systemctl restart httpd<p/re>
Now, open your favorite web browser and point it to
http://yourdomain.com to run the web installer. You will have to choose your database type and enter the necessary information to complete the installation.
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Habari for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.