Knowledgebase

How to Install Vanilla Forum on Ubuntu 18.04 LTS Print

  • 0

Vanilla is a simple discussion forum written in PHP. Vanilla source code is publicly hosted on Github. This guide will walk you through the Vanilla installation process on a fresh Ubuntu 18.04 LTS Rcs server instance using PHP, MySQL as a database, and Nginx as a web server.

Requirements

Vanilla Forum recommended software stack:

  • PHP version 7.2 or greater. PHP 7.3 or greater strongly recommended. This guide will use PHP 7.2.x.
  • PHP extensions: mbstring, curl, gd, PDO, mysqli, openssl, gd, pdo.
  • MySQL version 5.7 or greater (or Percona/MariaDB equivalent). This guide will use MySQL 5.7.x.
  • Web server software (Nginx, Apache). This guide will use Nginx.

Before you begin

Check the Ubuntu version.

lsb_release -ds
# Ubuntu 18.04.2 LTS

Create a new non-root user account with sudo access and switch to it.

adduser johndoe --gecos "John Doe"
usermod -aG sudo johndoe
su - johndoe

NOTE: Replace johndoe with your username.

Set up the timezone.

sudo dpkg-reconfigure tzdata

Ensure that your system is up to date.

sudo apt update && sudo apt upgrade -y

Install the needed packages.

sudo apt install -y zip unzip curl wget git

Install PHP

Install PHP, as well as the necessary PHP extensions.

sudo apt install -y php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-mbstring php7.2-curl php7.2-gd php7.2-mysql php7.2-json

Check the version.

php -v
# PHP 7.2.19-0ubuntu0.18.04.2 (cli) (built: Aug 12 2019 19:34:28) ( NTS )

Check installed PHP extensions.

php -m

# mbstring
# curl
# gd
# PDO
# mysqli
# openssl
# . . .

Install MySQL

Install MySQL.

sudo apt install -y mysql-server

Check the version.

mysql --version
# mysql  Ver 14.14 Distrib 5.7.27, for Linux (x86_64) using  EditLine wrapper

Run the mysql_secure_installation script to improve the security of your MySQL installation.

sudo mysql_secure_installation

Log into MySQL as the root user.

sudo mysql -u root -p
# Enter password:

Create a new MySQL database and user and remember the credentials.

CREATE DATABASE dbname;
GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit;

Install Nginx

Install Nginx.

sudo apt install -y nginx

Check the version.

sudo nginx -v
# nginx version: nginx/1.14.0 (Ubuntu)

Configure Nginx for use with the Vanilla forum.

sudo vim /etc/nginx/sites-available/vanilla.conf

Populate the file with the below config.

server {

  listen 80;
  server_name example.com;
  root /var/www/vanilla;
  index index.php;

  location ~* /\.git { deny all; return 403; }
  location /build/ { deny all; return 403; }
  location /cache/ { deny all; return 403; }
  location /cgi-bin/ { deny all; return 403; }
  location /uploads/import/ { deny all; return 403; }
  location /conf/ { deny all; return 403; }
  location /tests/ { deny all; return 403; }
  location /vendor/ { deny all; return 403; }

  location ~* ^/index\.php(/|$) {
    include snippets/fastcgi-php.conf;
    fastcgi_param SCRIPT_NAME /index.php;
    fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
    fastcgi_param X_REWRITE 1;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
  }

  location ~* \.php(/|$) {
    rewrite ^ /index.php$uri last;
  }
  
  location / {
    try_files $uri $uri/ @vanilla;
  }

  location @vanilla {
    rewrite ^ /index.php$uri last;
  }

}

Activate the new vanilla.conf configuration by linking the file to the sites-enabled directory.

sudo ln -s /etc/nginx/sites-available/vanilla.conf /etc/nginx/sites-enabled

Test the configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install Vanilla forum

Navigate to the /var/www directory.

cd /var/www

Download the latest Vanilla forum.

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

Unzip it and remove zip archive.

sudo unzip vanilla-core-3.1.zip
sudo rm vanilla-core-3.1.zip

Rename the directory to vanilla.

sudo mv package vanilla

Provide appropriate ownership.

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

Navigate to the folder where you uploaded Vanilla in your web browser and follow the instructions on the screen to complete the setup.

Vanilla is a simple discussion forum written in PHP. Vanilla source code is publicly hosted on Github. This guide will walk you through the Vanilla installation process on a fresh Ubuntu 18.04 LTS Rcs server instance using PHP, MySQL as a database, and Nginx as a web server. Requirements Vanilla Forum recommended software stack: PHP version 7.2 or greater. PHP 7.3 or greater strongly recommended. This guide will use PHP 7.2.x. PHP extensions: mbstring, curl, gd, PDO, mysqli, openssl, gd, pdo. MySQL version 5.7 or greater (or Percona/MariaDB equivalent). This guide will use MySQL 5.7.x. Web server software (Nginx, Apache). This guide will use Nginx. Before you begin Check the Ubuntu version. lsb_release -ds # Ubuntu 18.04.2 LTS Create a new non-root user account with sudo access and switch to it. adduser johndoe --gecos "John Doe" usermod -aG sudo johndoe su - johndoe NOTE: Replace johndoe with your username. Set up the timezone. sudo dpkg-reconfigure tzdata Ensure that your system is up to date. sudo apt update && sudo apt upgrade -y Install the needed packages. sudo apt install -y zip unzip curl wget git Install PHP Install PHP, as well as the necessary PHP extensions. sudo apt install -y php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-mbstring php7.2-curl php7.2-gd php7.2-mysql php7.2-json Check the version. php -v # PHP 7.2.19-0ubuntu0.18.04.2 (cli) (built: Aug 12 2019 19:34:28) ( NTS ) Check installed PHP extensions. php -m # mbstring # curl # gd # PDO # mysqli # openssl # . . . Install MySQL Install MySQL. sudo apt install -y mysql-server Check the version. mysql --version # mysql Ver 14.14 Distrib 5.7.27, for Linux (x86_64) using EditLine wrapper Run the mysql_secure_installation script to improve the security of your MySQL installation. sudo mysql_secure_installation Log into MySQL as the root user. sudo mysql -u root -p # Enter password: Create a new MySQL database and user and remember the credentials. CREATE DATABASE dbname; GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password'; FLUSH PRIVILEGES; exit; Install Nginx Install Nginx. sudo apt install -y nginx Check the version. sudo nginx -v # nginx version: nginx/1.14.0 (Ubuntu) Configure Nginx for use with the Vanilla forum. sudo vim /etc/nginx/sites-available/vanilla.conf Populate the file with the below config. server { listen 80; server_name example.com; root /var/www/vanilla; index index.php; location ~* /\.git { deny all; return 403; } location /build/ { deny all; return 403; } location /cache/ { deny all; return 403; } location /cgi-bin/ { deny all; return 403; } location /uploads/import/ { deny all; return 403; } location /conf/ { deny all; return 403; } location /tests/ { deny all; return 403; } location /vendor/ { deny all; return 403; } location ~* ^/index\.php(/|$) { include snippets/fastcgi-php.conf; fastcgi_param SCRIPT_NAME /index.php; fastcgi_param SCRIPT_FILENAME $realpath_root/index.php; fastcgi_param X_REWRITE 1; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; } location ~* \.php(/|$) { rewrite ^ /index.php$uri last; } location / { try_files $uri $uri/ @vanilla; } location @vanilla { rewrite ^ /index.php$uri last; } } Activate the new vanilla.conf configuration by linking the file to the sites-enabled directory. sudo ln -s /etc/nginx/sites-available/vanilla.conf /etc/nginx/sites-enabled Test the configuration. sudo nginx -t Reload Nginx. sudo systemctl reload nginx.service Install Vanilla forum Navigate to the /var/www directory. cd /var/www Download the latest Vanilla forum. sudo wget https://open.vanillaforums.com/get/vanilla-core-3.1.zip Unzip it and remove zip archive. sudo unzip vanilla-core-3.1.zip sudo rm vanilla-core-3.1.zip Rename the directory to vanilla. sudo mv package vanilla Provide appropriate ownership. sudo chown -R www-data:www-data /var/www/vanilla Navigate to the folder where you uploaded Vanilla in your web browser and follow the instructions on the screen to complete the setup.

Was this answer helpful?
Back

Powered by WHMCompleteSolution