How to Install phpBB on Debian 11

how to install phpbb on debian 11

In this guide, we’ll go over everything you need to install phpBB on Debian 11.

Running your own platform where you and your visitors can discuss topics you all enjoy is exactly phpBB’s purpose. phpBB is designed to be a fast, reliable forum platform that integrates easily into an existing website. Let’s go into the details on how to install phpBB on Debian 11.

Prerequisites

In order to set up phpBB, you’re going to need a VPS or dedicated server. This list of software is also required to run phpBB, but we’ll be showing you how to install all of it:

  • PHP 7.1 or newer (all required modules listed in the guide)
  • MariaDB 5 or newer (other database servers are supported)
  • A web server such as Nginx or Apache2 (we will use Apache2)

Let’s jump right into it – the installation should take around 15 minutes if you have a good Internet connection.

1. Setting up a web server

When running a server accessible from the Internet, it is vital to install all of the latest updates. This does take some time, but it is a lot faster than restoring a site from a backup or starting over if someone were to gain access to your website or server.

To install the latest updates, we can check for updates and update our system with two commands run at once:

sudo apt update && sudo apt upgrade

You will need to run this as an administrator or super user. Make sure to enter your login password when prompted.

If a new kernel was installed, we recommend rebooting when convenient in order to run your system on the latest kernel.

Now that we are completely up-to-date, installing a web server is very straightforward:

sudo apt install apache2

You can access your web server at your server’s IP address (or domain name if you have purchased one and set up the DNS to point to your server). The default folder used for your website content is /var/www/html/.

2. Installing PHP and all required modules

With our new web server up and running, we can install PHP and all of the required modules for phpBB to run properly:

sudo apt install php7.4 php7.4-json php7.4-mbstring php7.4-xml php7.4-mysql php7.4-common php7.4-gd

Make sure to approve the installation. PHP 7.4 is now installed on your server.

3. Installing a database server – MariaDB

Your database will hold all of the text and information about your phpBB website. phpBB supports several different database servers, but we will use MariaDB. MariaDB is functionally identical to MySQL while being open-source. You can install it like so:

sudo apt install mariadb-server mariadb-client

Once your database server is installed, it’s important to run the first-time setup command:

mysql_secure_installation

With this command, you configure a new root password for the database server, as well as set important security settings. You will be asked for a root password at the start – this is NOT your operating system root password! Instead, this is the root password of the database server. This is set to nothing by default, so just press the [Enter] key on your keyboard when prompted without typing any text.

Here is an example of our recommended answers to the questions asked during the setup:

phpbb securing mariadb

These are the settings to use for a production system. Now that the database server has been added, we will need to create a database for phpBB to use.

4. Configuring the database server

To log into the database command line, run this command:

mysql -u root -p

Type in the root password that you set when running the first-time setup command. You should now be logged into the command line of the database manager.

Create a database, replacing <database name> with the name of your database (do not add the ‘<‘ and ‘>’ characters)

CREATE DATABASE <database name>;

Now we need a user for this database. We will create one like this:

CREATE USER 'usernamehere'@'localhost' IDENTIFIED BY 'changethispassword';

Then, we give that new user complete access to the database we made earlier:

GRANT ALL on <database name>.* TO 'usernamehere'@'localhost';

Finally, commit the changes made to the privileges:

FLUSH PRIVILEGES;

You can exit the command line by typing QUIT;. Just like that, we now have a database, as well as a user that will allow phpBB to access the database.

5. Installing phpBB on Debian 11

With everything set up, we can finally download and set up phpBB. Download it to your web root by running this command:

wget -P /var/www/html/ https://download.phpbb.com/pub/release/3.3/3.3.9/phpBB-3.3.9.zip

Now we’ll enter our web root folder and unzip the archive:

cd /var/www/html/ && unzip phpBB-*

Unfortunately, since phpBB is saved in a subfolder, we will need to move all of the contents out of there and into the web root folder:

cp -Rp phpBB3/* . && rm -rf phpBB3

This command copies all of the contents of the subfolder (including hidden files) into the folder we are currently in (/var/www/html) and deletes the directory it was in originally. You can ignore any errors as they are expected with copying the hidden files.

We now need to adjust the file ownership for the web server. This allows the webserver to edit the files as needed:

chown -R www-data:www-data /var/www/html/*

You should now be able to access the installation wizard at https://yourdomainorip/ –  the webpage should show up automatically.

phpbb install debian11

To start installing, click on the Install tab, then click on the Install button. You will be asked to fill in some information:

phpbb install wizard

Make sure to pick your own username, email, and password. The harder they are to guess, the harder it will be for someone to log into your website. Click on Submit when done. You will now need to set up your database credentials:

phpbb database setup

You need to use the credentials that you set up earlier in the tutorial. The values in the screenshot only serve as example values. We recommend using 127.0.0.1 for the database connection instead of localhost. You can leave the server port field blank. Change the table prefix if you plan on setting up more than one phpBB instance inside of one database. Click on Submit to continue.

The next step is setting up your server configuration:

phpbb server configuration

Since we are not using SSL (https://) we should leave Cookie secure set to No. Make sure to leave the Server protocol set to http:// unless you have configured an SSL certificate already. Under the Domain name, your server IP or domain should already be present there. We suggest leaving “Force server URL settings” set to No unless you know how your server is set up already. Click on Submit to continue.

Up next is the email configuration:

phpbb email setup

If you do not plan on using email on your website, you can set “Enable board-wide emails” to Disable. Note that user creation  If you plan on using SMTP, you can set your SMTP server details here. Click on Submit when done.

Finally, we can configure our bulletin board information:

phpbb site setup

Set your board title, language, and a short description. Click on Submit when done. The installation will begin now. When finished, you can click on the “Take me to the ACP” link to go to the admin control panel.

You have successfully installed phpBB on Debian 11! You can now create forums, boards, posts, and more.

Was this guide helpful in getting your forum board online? We would appreciate you mentioning us on social media or even on your new board. Thank you for reading.

Leave a Comment