How to Install phpBB with Apache on Ubuntu 20.04

phpBB is an opensource bulletin board package written in PHP. It can be used to to create forums, start topics and share ideas in a wholesome and organized manner. PHPBB, which is short for PHP Bulletin Board. It is mobile friendly and responsive.

It is easy to install phpBB on most web servers such as Apache and Nginx and also easy to administer and use.

In this tutorial, we learn how to install phpBB with Apache on Ubuntu 20.04.

Step 1: Install LAMP stack

PHPBB is written in PHP and is accessed by users from a web browser. This, therefore. implies that we need to first install a web server.

To be more precise, we need to install the LAMP stack which provides support for Apache webserver, MariaDB database, and PHP.

First following our comprehensive guide on how to install LAMP stack on Ubuntu 20.04.

Once the LAMP stack is installed, the following PHP modules that are required by PHPBB to function as expected.

$ sudo apt install libapache2-mod-php7.4 php7.4-gd php7.4-curl openssl php-imagick php7.4-intl php7.4-json php7.4-ldap php7.4-common php7.4-mbstring php7.4-mysql php7.4-imap php7.4-sqlite3 php-net-ftp php7.4-zip unzip php7.4-pgsql php-ssh2 php7.4-xml

Step 2: Create database for phpBB

phpBB requires a database engine to store all of its data. Thankfully, it supports a myriad of database servers including SQLite, PostgreSQL MariaDB / MySQL, and even Microsoft SQL server.

We already have MariaDB / MySQL already in place in the LAMP stack, and this is what we will use to create the database for phpBB.

So, log in to the MariaDB server:

$ sudo mysql -u root -p

Then create the database for PHPBB, then create the user to the database and assign all privileges to the user.

CREATE DATABASE phpbb_db;
GRANT ALL ON phpbb_db.* to 'phpbb_user'@'localhost' IDENTIFIED BY 'myP@ssword';

Then save the changes and exit the database.

FLUSH PRIVILEGES;
EXIT;

Step 3: Download and configure phpBB

With all the components required to support the installation of PHPBB ready, we are going to download the binary file for PHPBB. At the time of writing this down, the latest release of PHPBB is version 3.3.4. Of course, chances are that there will be a newer version by the time you are reading this tutorial.

Change directory to /opt directory, you can use any directory:

$ cd  /opt

Download the zip file into the /opt directory:

$ sudo wget -c https://download.phpbb.com/pub/release/3.3/3.3.4/phpBB-3.3.4.zip

Once downloaded, unzip the compressed file:

$ unzip phpBB-3.3.4.zip

Note: If unzip command not found, install using apt install unzip.

Then move it to the webroot directory and rename it to phpbb for simplicity purposes.

$ sudo mv phpBB3 /var/www/html/phpbb

phpBB is secure but make sure to set proper permissions on the webroot directory

To set the appropriate ownership and permissions:

$ sudo chown -R www-data:www-data /var/www/html/phpbb
$ sudo chmod -R 755 /var/www/html/phpbb

Step 4: Configure a virtual host for phpBB

A virtual host is required for PHPBB so that Apache can easily host PHPBB files without any conflict with the default Apache configuration.

To create a PHPBB virtual host file, use a text editor to create a file.

$ sudo vim /etc/apache2/sites-available/phpbb.conf

Append the following configuration:

<VirtualHost *:80>
      ServerAdmin admin@your_domain.com
      DocumentRoot /var/www/html/phpbb
      ServerName server-IP or FQDN

      <Directory /var/www/html/phpbb>
                Options FollowSymlinks
                AllowOverride All
                Require all granted
       </Directory>

ErrorLog ${APACHE_LOG_DIR}/your-domain.com_error.log
CustomLog ${APACHE_LOG_DIR}/your-domain.com_access.log combined

</VirtualHost>

For the ServerName attribute, specify your Server's IP address or Fully Qualified Domain Name.

Once done, save the changes and exit the configuration file.

Next, enable the PHPBB virtual host.

$ sudo a2ensite phpbb

Then enable the Apache rewrite module.

$ sudo a2enmod rewrite

For the changes to come into effect, restart the Apache webserver.

$ sudo systemctl restart apache2

Step 5: Complete the installation on a web browser

To finalize the installation, launch your browser and browser the URL shown.

http://server-ip

The Welcome Page comes into view. It provides an introduction to PHPBB. To proceed, click on the 'INSTALL' tab shown.

PHPBB information page during installation
PHPBB information page during installation

This section provides information about the requirements that are needed before going further with the installation. If everything looks good, simply click 'Install'.

PHPBB Installation Welcome page
PHPBB Installation Welcome page

Next, fill in the details of the Administrator user and password and click on 'Submit'.

PHPBB Administrator configuration
PHPBB Administrator configuration

Enter the database details. In case you have forgotten, refer to Step 2.

PHPBB database configuration
PHPBB database configuration

In the next step, simply accept the defaults and click 'Submit'.

PHPBB server configuration options
PHPBB server configuration options

If your server has an email functionality, fill in the details of the SMTP server including the server address, port, SMTP username, and password, and click 'Submit'. If email functionality is not configured, simply click 'Submit' without changing any parameter.

PHPBB fill in Email configuration details
PHPBB fill in Email configuration details

Next, Specify the settings of the Bulletin Board such as the default language, Board Title, and a short description of the board. Then click 'Submit'.

PHPBB bulletin board configuration
PHPBB bulletin board configuration

The installer will then install the files needed for PHPBB. The installation takes about a minute.

PHPBB underway

Once complete, the installer will provide feedback that the installation was successful. Now click on 'the ACP' link provided.

PHPBB installation successful
PHPBB installation successful

This takes you to the Admin panel shown.

PHPBB Forum Administration
PHPBB Forum Administration

To check phpBB version go to Administration Control Panel and click Admin index, version is listed under STATISTIC.

check version

Lastly, delete the Install directory.

$ sudo rm -rf /var/www/html/install

And that's it. The installation of phpBB is finally done. You can now create forums, configure permissions for users, moderate topic discussions and perform a whole lot more of other configurations.

Conclusion

In this tutorial we learned how to install phpBB with Apache on Ubuntu 20.04.

If you have any feedback and suggestion please comment below.

Leave a Comment