How to Install Vanilla Forums on CentOS 7
Vanilla Forums is an open-source multi-lingual forum software written in PHP. It provides all of the features you need to run a successful forum. It’s easy to install and use, and it comes with lots of add-ons and themes to choose from. Let’s begin with the installation.
Prerequisites
- For the purposes of this tutorial, we will be using a CentOS VPS.
- You will also need a working LAMP or LEMP (Linux, Apache/Nginx, MySQL/MariaDB, PHP) stack. We will also show you how to install your own LAMP stack as a part of this tutorial.
- Full SSH root access or a user with sudo privileges is also required.
Step 1: Connect to Your Server
Before we begin, you will need to connect to your server via SSH as the root user or as any other user that has sudo privileges.
To connect to your server as the root user, use the following command:
ssh root@IP_ADDRESS -p PORT_NUMBER
Make sure to replace IP_ADDRESS and PORT_NUMBER with your actual server IP address and SSH port number.
Once logged in, make sure that your server is up-to-date by running the following commands:
sudo yum update
Step 2: Install LAMP
Before we proceed with the Vanilla Forums installation, we will need to prepare our server and set up a LAMP stack. If you already have a working LAMP setup installed on your server, you can skip this step and go ahead to the next step of this tutorial.
To install the Apache web server, run the following command:
yum install httpd
To install the MariaDB database server, enter the following command:
yum install mariadb-server
When the MariaDB installation is complete, you can also run the following command to secure your MariaDB installation:
sudo mysql_secure_installation
If the program asks you to enter your current MariaDB root password, just press your [Enter] key once, as no password is set by default when installing MariaDB.
A few more questions will be displayed on-screen – it is recommended that you answer yes to all of them by entering the character ‘Y’:
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y
You will also need to enable MariaDB and Apache to start on boot with:
sudo systemctl enable httpd sudo systemctl enable mariadb
To enable the PHP 7.3 repository on your server, run the following commands:
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo yum install yum-utils sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm sudo yum-config-manager --enable remi-php73
To install PHP 7.3 along with the other extensions required by Vanilla Forums, run the following command:
sudo yum install php73 php73-php php73-php-mysqlnd php73-php-opcache php73-php-xml php73-php-xmlrpc php73-php-gd php73-php-mbstring php73-php-json
To verify PHP 7.2 is successfully installed, run the following command:
php73 -v
You should get the following output on your screen:
PHP 7.3.7 (cli) (built: Jul 3 2019 11:30:22) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.7, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.7, Copyright (c) 1999-2018, by Zend Technologies
Step 3: Download Vanilla Forums
Now that we have our LAMP stack installed, and we can start with our Vanilla Forums installation and configuration.
First, let’s download the latest stable Vanilla Forums version from this link. At the moment of writing this tutorial, the latest stable version 3.0.2. To download this version on your server, you can run the following command. We have added the download link into the command for you:
sudo wget https://open.vanillaforums.com/get/vanilla-core-3.0.2.zip
Let’s extract the files to the /var/www location on our server with this next line:
sudo unzip vanilla-core-3.0.2.zip -d /var/www
Note: If you don’t have the unzip package installed on your server, you can install it with the following command: yum install unzip
Remove the downloaded file with:
rm vanilla-core-3.0.2.zip
Rename the extracted directory named package to vanilla with the following command:
mv /var/www/package /var/www/vanilla
The owner of all of these files needs to be the user of the web server running on your system. In our example, we are using the Apache web server and Apache runs as ‘apache’ user on CentOS 7. To change the owner and set the correct permissions for these files, you need to run the following command:
sudo chown -R apache:apache /var/www/vanilla
Step 4: Configure the Database
Next, we need to create a new database for our Vanilla Forums application. To do this, log in to your MariaDB database server as the root user by typing the following command:
sudo mariadb -u root -p
Then enter the password you made for your MariaDB user. If you did not perform the ‘mysql_secure_installation’ script, just press the [Enter] key once, as there is no default password.
Once you are signed in, create a new database and user by running the following commands on the MariaDB shell:
CREATE DATABASE vanilla_db; CREATE USER vanilla_user@localhost IDENTIFIED BY 'strong-password'; GRANT ALL PRIVILEGES ON vanilla_db.* TO vanilla_user@localhost; FLUSH PRIVILEGES;
You can replace the database and username with your own and also make sure to replace strong-password with an actual strong password.
To exit the MariaDB database server command line, type:
exit
Step 5: Configure Apache
In this step, we will show you how to create a virtual host file for Apache – this is so you can access your Vanilla Forums using your domain name.
Create the virtual host file by executing the following command. We’ll be using ‘nano’ as our text editor, but you can use whatever you like:
sudo nano /etc/httpd/conf.d/vanilla.conf
And enter the following information:
<VirtualHost *:80> DocumentRoot /var/www/vanilla/ ServerName mydomain.com <Directory /var/www/vanilla/> Options FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog /var/log/httpd/vanilla_error.log CustomLog /var/log/httpd/vanilla_access.log combined </VirtualHost>
Save and quit the file once the changes have been made.
In our example, we will use a domain called mydomain.com. Make sure to replace mydomain.com with your actual domain/subdomain name that you would like to use for your Vanilla Forums.
Reload your Apache server in order to activate the new configuration:
sudo systemctl reload httpd
Step 6: Installing Vanilla Forums
You can now navigate to http://mydomain.com in your browser to access the Vanilla Forums installation wizard.
You need to enter your database information which was created in Step 4 of this tutorial (username, database name, and password). If you have Apache web server running on your VPS you will also need to select the “Use Vanilla’s .htaccess.” option.
Enter the name of your application and admin email, username, and password, and then click on the Continue button.
The installation will be automatically completed and you will be taken to the Vanilla Forums dashboard.
That’s it! Vanilla Forums has been successfully installed on your CentOS 7 server.