By Hazel Virdó
senior technical writer
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:
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.
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
-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.
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
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.
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
sudo chown -R www-data:www-data /var/www/html/
Move to the
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/
In this step, we’ll finish the installation by adding database, adminstrator, and email details via the phpBB installation website.
Navigate over to
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.
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.
In this step, we’ll clean up after our installation by removing unnecessary files and correcting some permissions.
Remove some permissions on the
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!
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
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 now
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
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 BEFORE ‘index.html’.
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!)
If i am hosting multiple sites,
Rather than /var/www/html/
can I have it at
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?
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?
Unfortunately i keep getting an error at:
Terminal keeps responding with:
Of course I’m not using “sammy” but you most likely get what I mean. How can I fix this?