How To Install phpBB on Ubuntu 14.04
How To Install phpBB on Ubuntu 14.04


How To Install phpBB on Ubuntu 14.04



phpBB is a free flat-forum bulletin board software solution that can be used to stay in touch with a group of people or can power your entire website. You can create a very unique forum in minutes using the extensive database of user-created modifications and styles database containing hundreds of style and image packages.

In this tutorial, you’ll learn how to install phpBB forums on Ubuntu 14.04.


For this tutorial, all you’ll need is:

Step 1 — Installing the LAMP stack

In this step, we’ll install the LAMP stack.

First, update your packages.

sudo apt-get update

Next, set the DEBIAN_FRONTEND environment variable to noninteractive, so the installation doesn’t prompt you for input.

export DEBIAN_FRONTEND=noninteractive

Finally, install the LAMP stack (plus unzip, which handles .zip files). This command may take a few minutes to run, because we’re installing a lot of packages.

sudo -E apt-get -y install apache2 mysql-server mysql-client php5 php5-mysql php5-gd imagemagick unzip

The -E flag for sudo preserves our environment variables, so DEBIAN_FRONTEND gets recognized; the -y flag for apt-get will assume “yes” to all prompts, so the whole command should run successfully without needing any user input.

Step 2 — Creating a Database

In this step, we’ll create a database and user with privileges for it.

First, create the database. Here it’s named phpBB, but you can name it whatever you like.

sudo mysqladmin create phpBB

Next we create a user and password, which are “sammy” and “badpassword”, respectively. Make sure you change these values, especially the password!

sudo mysql -Bse "create user 'sammy'@'localhost' identified by 'badpassword';"

Next, we grant our user privileges in our database.

sudo mysql -Bse "grant all privileges on \`phpBB\`.* to 'sammy'@'localhost';"

And finally, we update the grant tables.

sudo mysqladmin flush-privileges

Step 3 — Installing phpBB

In this step, we’ll install phpBB.

First, download the latest version of phpBB. This is the latest version at the time of writing, but you can double check on their website.


Unzip the package we downloaded.


Create a backup directory for any existing website files.

mkdir ~/website-backup

Move any existing website files out.

sudo mv /var/www/html/* ~/website-backup/

Note: If you haven’t added anything to your website (e.g. if you’re going through this tutorial on a brand new Droplet), the only thing in /var/www/html/ is the Apache default home page. If you don’t want to save this, you can delete the backup directory at this point with rm -rf ~/website-backup/.

Copy the phpBB files over into Apache’s default folder.

sudo cp -R phpBB3/* /var/www/html/

Next, we want to update the permissions on the phpBB files. To learn more about Linux permissions, you can read this article and this article.

First, add yourself to the www-data group. Use the sudo non-root username you chose here, instead of sammy.

sudo usermod -aG www-data sammy

Next, change the owner and group of the files in /var/www/html to www-data.

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

Move to the /var/www/html/ directory.

cd /var/www/html/

Add permissions for the group to the following directories and files.

sudo chmod 660 images/avatars/upload/ config.php
sudo chmod 770 store/ cache/ files/

Step 4 — Finishing Installation

In this step, we’ll finish the installation by adding database, adminstrator, and email details via the phpBB installation website.

Navigate over to http://your_server_ip/install.

Click on the INSTALL tab.

You should have all the required packages already installed. Click Proceed to next step, then Start install.

Enter the database credentials, replacing the database name, username, and password with your own values.

  • Database type: MySQL with MySQLi Extension
  • Database server hostname or DSN: localhost
  • Database name: phpBB
  • Database username: sammy
  • Database password: badpassword

Then click Proceed to next step. For most steps after this point, you’ll have to click the Proceed to next step button to move on.

Now you should see a successful database connection.

In this next step, you should set up your administrator username and password. The administrator of a board has many powers, including fine-tuning the board settings and managing users. You can find out more about administrators in the phpBB Administration Guide.

Set up email settings if you have a custom SMTP server. If you don’t and you’d like more information, check out this article on how to set up an STMP server. Otherwise, stick with the default values.

Your installation is now (almost) complete.

Step 5 — Cleaning Up

In this step, we’ll clean up after our installation by removing unnecessary files and correcting some permissions.

Remove some permissions on the config.php file.

sudo chmod 640 /var/www/html/config.php

Now that the installation is done, you should delete the /var/www/install folder. phpBB will not operate unless this directory is deleted, and a warning message will be displayed.

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

You can delete the docs/ directory if you want to, too, but this isn’t necessary.


Now you should be able to access your phpBB forum at your Droplet’s IP address!

Creative Commons License