phpBB featured image

Installing phpBB on Ubuntu 20.04

PhpBB stands for “PHP Bulletin Board.” It’s a free flat-forum bulletin board software solution. It’s licensed under the GPL license as free and open-source software. PhpBB can instantly establish a dedicated space for people to gather and communicate. It also supports popular database engines (MySQL, Oracle Database, SQLite, PostgreSQL, etc.), flat message structures, hierarchical sub-forums, user groups, full-text search, plugins, and email notifications. In this guide, we will go through the steps to install phpBB on Ubuntu 20.04.

Prerequisites

Proceeding into the tutorial, we will assume that the system is running Ubuntu 20.04 and is properly configured. Because the guide involves system-level changes, it also requires having access to a non-root user with sudo privileges. To get you started, you can follow the steps of this tutorial to install your Ubuntu server. Furthermore, in order to configure your sudoers file follow this tutorial.

Install phpBB

Install the LAMP stack

The LAMP stack is the foundation for Linux-hosted websites. It’s a collection of different software components. The components are arranged in layers, supporting one another. Any website and web app could run on top of this stack.

  • Linux: It’s the operating system. Linux is the foundation of the stack model. All the other layers run on top of it. In this guide, we will use Ubuntu 20.04 LTS.
  • Apache: It’s the second layer of the stack, consisting of web server software (Apache Web Server, in most cases). Web servers are responsible for translating the web browser requests to the correct website. Follow this tutorial to install Apache on Ubuntu quickly.
  • MySQL: The third layer is the database engine (MySQL, in most cases). MySQL stores data that can be retrieved using queries to construct a website. It usually sits alongside Apache (layer 2). In high-end configurations, MySQL can be offloaded to a different host server. Take a look at our tutorial on how to set up MySQL and MySQL basics.
  • PHP: It’s the fourth and final layer. It consists of PHP and/or similar web programming languages. It’s where the websites and web applications run.

For a more in-depth understanding of the LAMP stack, check out our tutorial on setting up the LAMP stack on Ubuntu. In this guide, we will demonstrate a quick rundown of the LAMP installation process. First, launch a terminal and update the APT package database:

The following line will set a different value to the “DEBIAN_FRONTEND” environment variable so that the installation process doesn’t prompt for any input:

no input config

Finally, install the necessary packages. In addition to the stack components, we’ll also be installing “unzip” for handling ZIP files and “imagemagick” for image manipulation. Here, the “-E” flag is to preserve the environment variables:

package installation
Create phpBB database

The next step is to create a dedicated database for phpBB to store its contents. The following command will create a database named “phpBB.” The database name can be anything you like:

The next step is to create a password-protected user. You can follow our tutorial to learn more about MySQL users and permission management.

Now, replace the username and password with the appropriate values:

Next, grant all the privileges of the database “phpBB” to user “cloudsigma:”

To take the changes into effect, reload the MySQL privilege table:

Here, only the bare minimum of MySQL is demonstrated. To learn more about MySQL and its usage, check out this guide on how to set up MySQL and MySQL basics.

Install phpBB

Finally, we’ll be installing phpBB on our server. Check out phpBB download page:

download phpbb

Then, unzip the archive:

Before making any changes, it’s recommended to make a backup of the existing website files. In this example, we’ll be backing up all the website files to a separate directory:

Now, copy the phpBB files into Apache’s default folder:

The next step is to update the file permissions. Add the current user to the “www-data” group:

Instead of assigning the ownership to a specific user, we’ll be changing to the “www-data” group:

After that, change the current directory to “/var/www/html:”

Next, add the following permissions for the group to the following directories and files:

setup
Finish installation

Now, your phpBB installation is almost over. The software is finally ready to be installed. Launch phpBB on the web browser:

phpBB homepage

Then, go to the “INSTALL” tab:

install tab php phpBB

If it shows errors like missing PHP extensions (XML, mbstring, etc.), then open a terminal, and install the following additional packages:

missing packages

Once installed, restart the Apache web-server and click “Retest requirements:”

The next step will ask for the admin username and password for phpBB. An admin of a board holds all the powers, including fine-tuning board settings, user management, etc. For in-depth information about phpBB administration, check out the phpBB administration guide.

admin config phpBB

After that, PhpBB will ask for the necessary data and credentials. The fields will look something like this:

  • Database type: MySQL with MySQLi extension
  • Database server hostname or DSN: localhost
  • Database name: phpBB
  • Database username: cloudsigma
  • Database password: password123

database configuration

Next, click “Submit” to continue the installation. For all the consequential steps, verify the values and click “Submit:”

server configuration

smtp configuration phpBB

bulletin board configuration

Finally, the installation should be complete!

installation complete phpBB

Cleanup

As now your phpBB installation is complete, it’s time to clean up some residues. First, remove some permissions from the config.php file:

Then, delete the /var/www/html/install directory. Otherwise, phpBB won’t function and show a warning message:

Access phpBB

PhpBB should be accessible from the server’s IP address or domain:

phpbb homepage

Final thoughts

In this tutorial, we showed you a step-by-step overview of the process to install phpBB forums on Ubuntu 20.04. Installing phpBB for the first time will take a bit of time. However, the installation itself is a simple process.

Happy computing!