In this tutorial, we will show you how to install Vanilla Forums on a Debian 9 server or VPS.
Prerequisites
- A server or VPS running Debian 9.
- Apache web server 2.0 or higher including the
mod_rewrite
Apache module. Alternatively, you can use Nginx as a web server with PHP support in place of Apache 2. - PHP 7.1 or higher (PHP 7.3 is preferred) with the following PHP extensions enabled: mbstring, cURL, GD, and PDO.
- MySQL 5.7 or higher (or Percona/MariaDB).
- Access to the root user account (or access to an admin account with root privileges).
We’ll be covering the installation of all of these prerequisites, so don’t worry if you’re missing some or all of them. You can skip over the ones that you already have installed if needed, but we recommend following along in case something is configured differently from your setup.
Step 1: Log in to the Server & Update the Server OS Packages
Log in to your Debian server via SSH as the root user:
ssh root@IP_Address -p Port_number
You will need to replace ‘IP_Address‘ and ‘Port_number‘ with your server’s respective IP address and SSH port number. Additionally, replace ‘root’ with the username of the admin account if necessary.
Before we can start with the Vanilla Forums installation, we have to make sure that all Debian packages installed on the server are up to date. We can do this by running the following commands:
sudo apt-get update sudo apt-get upgrade
Once all packages are up to date, we can begin by installing Apache.
Step 2: Apache Web Server Installation
To install the Apache web server, run the following command:
apt-get install apache2
After the installation is complete, enable Apache to start automatically upon server boot with:
systemctl enable apache2
We can also check the status of your Apache service with the following command:
systemctl status apache2
Output:
● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; disabled; vendor preset: enabled) Active: active (running) since Wed 2019-07-24 10:09:17 CDT; 8s ago Process: 1204 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 1208 (apache2) CGroup: /system.slice/apache2.service ├─1208 /usr/sbin/apache2 -k start └─1209 /usr/sbin/apache2 -k start
Step 3: Install MariaDB and Create a MariaDB Database
For the purposes of this tutorial, we will install MariaDB to serve as the database server. This is where Vanilla Forums will store its posts and content. Run the following command to install MariaDB 10.1, the latest version available in the official Debian 9 repositories at the time of this article being written, along with some required MariaDB packages:
sudo apt-get install mariadb-common mariadb-client-10.1 mariadb-client-core-10.1 mariadb-server-10.1 mariadb-server-core-10.1
Once the installation is complete, issue the following command to further improve the security of your MariaDB server installation. The command is optional, however we strongly recommend it as it improves the security of your MariaDB server:
mysql_secure_installation
We recommend answering every prompt with ‘Y’.
Once this is done, create a new MariaDB database and user for the Vanilla Forums installation.
Log in to the MariaDB console as MariaDB user (e.g. root):
sudo mysql -uroot -p
Run the following commands to create a new MariaDB database, user, and grant privileges for the user to access the database:
MariaDB [(none)]> CREATE DATABASE vanilladb character set UTF8 collate utf8_bin;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON vanilladb.* TO 'vanilla'@'localhost' IDENTIFIED BY 'StrongPassword';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> quit
Remember to replace StrongPassword
with an actual strong password.
Step 4: Install PHP 7.3 and Required PHP Packages
We will be using the Ondřej Surý repository for PHP to install PHP 7.3. Import the signing key and enable the PPA for PHP 7.3 by using the following commands:
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add - echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
Install the ca-certificates
and apt-transport-https
packages by running the following command:
sudo apt-get install ca-certificates apt-transport-https
Once you are done with this, update your package manager once again using the command below:
sudo apt-get update
Install PHP 7.3 and PHP extensions:
apt-get install php7.3 php7.3-cli php7.3-common php7.3-curl php7.3-gd php7.3-intl php7.3-json php7.3-mbstring php7.3-mysql php7.3-zip libapache2-mod-php7.3
Disable PHP 7.0 if it is currently enabled:
sudo a2dismod php7.0
Then, enable PHP 7.3:
sudo a2enmod php7.3
Step 5: Create a new Apache Configuration File
Create a new Apache configuration file for the domain/subdomain name that we will be using to access the Vanilla Forums application. For this tutorial, we will use ‘vanilla.domain.com‘. Be sure to replace any occurrence of that domain name with your own registered domain name.
vi /etc/apache2/sites-available/vanilla.conf
Add the following lines:
<VirtualHost *:80> ServerName vanilla.domain.com DocumentRoot /var/www/vanilla/ CustomLog ${APACHE_LOG_DIR}/vanilla.domain.com.access.log combined ErrorLog ${APACHE_LOG_DIR}/vanilla.domain.com.error.log <Directory /var/www/vanilla> DirectoryIndex index.php Options -Indexes AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost>
Again, do not forget to replace vanilla.domain.com with your actual domain/subdomain name. Save and close the Apache configuration file.
Create a new directory named ‘vanilla’ in your web server’s directory:
mkdir -p /var/www/vanilla
To enable the newly created configuration file in Apache, run:
sudo a2ensite vanilla
Then, disable the default Apache configuration file using this next line:
sudo a2dissite 000-default
Also, we need to enable the Apache ‘rewrite’ module (if it is not already enabled):
sudo a2enmod rewrite
Check if there are errors with the newly created Apache configuration:
sudo apachectl -t Syntax OK
If the syntax is OK and there are no errors, we can restart the Apache web service:
sudo systemctl restart apache2.service
Step 6: Install Vanilla Forums
At the time of writing this tutorial, the latest stable version of Vanilla Forums is 3.1. Download the latest stable version of Vanilla Forums and extract it in the /var/www/
directory:
cd /var/www/ wget https://us.v-cdn.net/5018160/uploads/addons/1KCWYE1PTWN7.zip -o vanilla-core-3.1.zip mv package/* vanilla mv /var/www/package/.htaccess.dist /var/www/vanilla/.htaccess
Change the owner and set the correct permissions for all files in the /var/www/vanilla/
directory using the following command:
sudo chown -R www-data:www-data /var/www/vanilla
Open http://vanilla.domain.com
in your favorite web browser and follow the easy instructions: enter the database name, database username and password and set the username and password for the administrator user account of the Vanilla Forums application.
Then, click on the ‘Continue’ button and we will automatically be logged in to the Vanilla Forums administration back-end:
That’s it! You now have a working Vanilla Forums instance on your Debian 9 VPS.
PS. If you liked this post on how to install Vanilla Forums on Debian 9, please share it with your friends on the social networks using the share shortcuts, or simply leave a reply in the comments sections. Thanks.