How to Install Vanilla Forum on CentOS 7

Updated on January 29, 2018
How to Install Vanilla Forum on CentOS 7 header image

Vanilla forum is an open source forum application written in PHP. It is a fully customizable, easy to use, and supports external themes and plugins. It is packed with all the required features needed to run a forum. You can install a responsive theme to make the forum responsive to different screen sizes, or you can create a theme matching the style of your website. It supports SSO using WordPress, Jquery, SAML or OAuth. You can also set up social logins using Google, Facebook or Twitter. It easily integrates with many applications such as WordPress, MailChimp, Zendesk, Github, Salesforce and much more.

This guide was written for Vanilla Forums 2.3, but may also work on newer releases.

Prerequisites

  • A Vultr CentOS 7 server instance.
  • A sudo user.

For this tutorial, we will use forum.example.com as the domain name pointed towards the Vultr instance. Please make sure to replace all occurrences of the example domain name with the actual one.

Update your base system using the guide How to Update CentOS 7. Once your system has been updated, proceed to install the dependencies.

Install Apache

Install Apache.

sudo yum -y install httpd

Start Apache and enable it to automatically run at boot time.

sudo systemctl start httpd
sudo systemctl enable httpd

Install PHP 7.1

We will use PHP 7.1 to obtain maximum security and stability. First, add and enable the Remi repository.

sudo rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum -y install yum-utils
sudo yum-config-manager --enable remi-php71

Install the latest version of PHP along with the modules required by Vanilla Forum.

sudo yum -y install php php-gd php-mysqli php-mbstring php-curl php-cli php-pear php-devel php-openssl

Install MariaDB

MariaDB is a fork of MySQL. Add the MariaDB repository into your system. The default YUM repository contains an older version of MariaDB, which is unsupported by Vanilla.

echo "[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1" | sudo tee /etc/yum.repos.d/mariadb.repo

Install MariaDB.

sudo yum -y install mariadb mariadb-server

Start MariaDB and enable it to automatically start at boot time.

sudo systemctl start mariadb
sudo systemctl enable mariadb

Before configuring the database, you will need to secure MariaDB first.

sudo mysql_secure_installation

You will be asked for the current MariaDB root password. By default, there is no root password in a fresh MariaDB installation. Press the "Enter" key to proceed. Set a strong password for the root user of your MariaDB server and answer "Y" to all of the other questions that are asked. The questions asked are self-explanatory.

Log into the MySQL shell as root.

mysql -u root -p

Provide the password for the MariaDB root user to log in.

Run the following queries to create a database and a database user for the Vanilla installation.

CREATE DATABASE vanilla_data CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'vanilla_user'@'localhost' IDENTIFIED BY 'StrongPassword';
GRANT ALL PRIVILEGES ON vanilla_data.* TO 'vanilla_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

You can replace the database name vanilla_data and username vanilla_user according to your choice. Please make sure to change StrongPassword to a very strong password.

Install Vanilla forum

Download the Vanilla forum zip archive.

wget https://open.vanillaforums.com/get/vanilla-core.zip

Install unzip.

sudo yum -y install unzip

Extract the archive.

sudo unzip vanilla-core.zip -d /var/www/vanilla

Provide the appropriate ownership.

sudo chown -R apache:apache /var/www/vanilla

Allow HTTP traffic on port 80 through the firewall.

sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --zone=public --permanent --add-service=https
sudo firewall-cmd --reload

Create virtual host

Create a virtual host for your Vanilla forum site.

sudo nano /etc/httpd/conf.d/forum.example.com.conf

Populate the file.

<VirtualHost *:80>
    ServerName forum.example.com
    DocumentRoot /var/www/vanilla
    <Directory /var/www/vanilla>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

Restart Apache.

sudo systemctl restart httpd

Wrapping Up

Now that you have successfully installed and configured Vanilla forum, you can access the application on http://forum.example.com. Provide the database and administrator details. Once you have provided the required database and admin details, the setup will write into the database and you will be taken to the administration interface. You can now configure the forum according to your needs.

Congratulations, you have successfully installed Vanilla forum in CentOS 7 server.