// Tutorial //

How To Install phpBB on Ubuntu 14.04

Published on February 4, 2015
Default avatar
By Hazel Virdó
senior technical writer
How To Install phpBB on Ubuntu 14.04

Introduction

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.

Prerequisites

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.

wget https://www.phpbb.com/files/release/phpBB-3.1.2.zip

Unzip the package we downloaded.

unzip phpBB-3.1.2.zip

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.

Conclusion

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


Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.

Sign up
About the authors
Default avatar
senior technical writer

hi! i write do.co/docs now, but i used to be the senior tech editor publishing tutorials here in the community.

Still looking for an answer?

Was this helpful?
9 Comments

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Hi, thanks for this guide, I found a good place to obtain all extensions & stylers dedicated to phpBB 3.1.x, 3.2.x & 3.3.x, here: http://www.ezcom-fr.com

hey all,

Just want to recommend an addition to the guide here. If after the installation, you still get served with the Apache default page, then add “index.php” to the “/etc/apache2/mods-enabled/dir.conf” file BEFOREindex.html’.

sudo nano /etc/apache2/mods-enabled/dir.conf

	<IfModule mod_dir.c>
	        DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
	</IfModule>

Click here for screenshot

This will force the Apache server to load the index.php (from phpBB), instead of the index.html (the apache default ‘welcome’ page!)

Regards,

If i am hosting multiple sites,

Rather than /var/www/html/

can I have it at

/var/www/forum.domain.com/html ?

Hi there. I am having a problem granting privilages. I am getting the error ERROR at line 1: Unknown command ‘'’.

Any help appreciated. This is meaning that on the install my user has insufficient permissions I think

Please help! I’m trying to create the MySQL user, but: error: ‘Access denied for user ‘root’@‘localhost’ (using password: YES)’ Hw can I fix this?

Great tutorial!

I have one small problem. I’m running phpBB with Wordpress. I added the page to link widget so when you click on the Forums page you go to phpBB. To get this to work I had to rename the index.php file to phpbb3.php because WP uses/needs index.php to work. When I log in to phpBB it seems to call index.php because it puts me at WP’s main page. When I click the forum page again phpBB shows me as being logged in and works as it should. So it’s only logging into phpBB that seems to point back to the index.php page. Whats kinda cool is that when you log out it calls the index.php page which since I reset for WP it loads WP’s main page (this part I like lol).

when trying : sudo mysql -Bse “grant all privileges on `phpBB`.* to ‘sammy’@‘localhost’;” -p I keep getting: ERROR at line 1: Unknown command ‘'’.

What the heck? I know it’s got to be obvious, but I just can’t seem to iron this one out.

Everything has worked apart from one thing. I get this near the end of the installation: http://prntscr.com/6fd8a1 What am I doing wrong?

Hi Hazel,

Awesome tutorial!

Unfortunately i keep getting an error at:

sudo usermod -aG www-data sammy

Terminal keeps responding with:

usermod: user 'sammy' does not exist

Of course I’m not using “sammy” but you most likely get what I mean. How can I fix this?