PhpBB stands for “PHP Bulletin Board.” It’s a free flat-forum bulletin board software solution. It’s licensed under the GPL license as free and open-source software. PhpBB can instantly establish a dedicated space for people to gather and communicate. It also supports popular database engines (MySQL, Oracle Database, SQLite, PostgreSQL, etc.), flat message structures, hierarchical sub-forums, user groups, full-text search, plugins, and email notifications. In this guide, we will go through the steps to install phpBB on Ubuntu 20.04.
Prerequisites
Proceeding into the tutorial, we will assume that the system is running Ubuntu 20.04 and is properly configured. Because the guide involves system-level changes, it also requires having access to a non-root user with sudo privileges. To get you started, you can follow the steps of this tutorial to install your Ubuntu server. Furthermore, in order to configure your sudoers file follow this tutorial.
Install phpBB
Install the LAMP stack
The LAMP stack is the foundation for Linux-hosted websites. It’s a collection of different software components. The components are arranged in layers, supporting one another. Any website and web app could run on top of this stack.
- Linux: It’s the operating system. Linux is the foundation of the stack model. All the other layers run on top of it. In this guide, we will use Ubuntu 20.04 LTS.
- Apache: It’s the second layer of the stack, consisting of web server software (Apache Web Server, in most cases). Web servers are responsible for translating the web browser requests to the correct website. Follow this tutorial to install Apache on Ubuntu quickly.
- MySQL: The third layer is the database engine (MySQL, in most cases). MySQL stores data that can be retrieved using queries to construct a website. It usually sits alongside Apache (layer 2). In high-end configurations, MySQL can be offloaded to a different host server. Take a look at our tutorial on how to set up MySQL and MySQL basics.
- PHP: It’s the fourth and final layer. It consists of PHP and/or similar web programming languages. It’s where the websites and web applications run.
For a more in-depth understanding of the LAMP stack, check out our tutorial on setting up the LAMP stack on Ubuntu. In this guide, we will demonstrate a quick rundown of the LAMP installation process. First, launch a terminal and update the APT package database:
1 |
sudo apt update |
The following line will set a different value to the “DEBIAN_FRONTEND” environment variable so that the installation process doesn’t prompt for any input:
1 |
export DEBIAN_FRONTEND=noninteractive |
Finally, install the necessary packages. In addition to the stack components, we’ll also be installing “unzip” for handling ZIP files and “imagemagick” for image manipulation. Here, the “-E” flag is to preserve the environment variables:
1 |
sudo -E apt install -y apache2 mysql-server mysql-client php php-mysql php-gd imagemagick unzip |
Create phpBB database
The next step is to create a dedicated database for phpBB to store its contents. The following command will create a database named “phpBB.” The database name can be anything you like:
1 |
sudo mysqladmin create phpBB |
The next step is to create a password-protected user. You can follow our tutorial to learn more about MySQL users and permission management.
Now, replace the username and password with the appropriate values:
1 |
sudo mysql -Bse "create user 'cloudsigma'@'localhost' identified by 'password123';" |
Next, grant all the privileges of the database “phpBB” to user “cloudsigma:”
1 |
sudo mysql -Bse "grant all privileges on `phpBB`.* to 'cloudsigma'@'localhost';" |
To take the changes into effect, reload the MySQL privilege table:
1 |
sudo mysqladmin flush-privileges |
Here, only the bare minimum of MySQL is demonstrated. To learn more about MySQL and its usage, check out this guide on how to set up MySQL and MySQL basics.
Install phpBB
Finally, we’ll be installing phpBB on our server. Check out phpBB download page:
1 |
wget https://download.phpbb.com/pub/release/3.3/3.3.3/phpBB-3.3.3.zip <span class="s1">--no-check-certificate</span> |
Then, unzip the archive:
1 |
unzip phpBB-3.3.3.zip |
Before making any changes, it’s recommended to make a backup of the existing website files. In this example, we’ll be backing up all the website files to a separate directory:
1 2 |
mkdir ~/site-backup sudo mv /var/www/html/* ~/site-backup/ |
Now, copy the phpBB files into Apache’s default folder:
1 |
sudo cp -R phpBB3/* /var/www/html/ |
The next step is to update the file permissions. Add the current user to the “www-data” group:
1 |
sudo usermod -aG www-data cloudsigma |
Instead of assigning the ownership to a specific user, we’ll be changing to the “www-data” group:
1 |
sudo chown -R www-data:www-data /var/www/html/ |
After that, change the current directory to “/var/www/html:”
1 |
cd /var/www/html/ |
Next, add the following permissions for the group to the following directories and files:
1 2 |
sudo chmod 660 images/avatars/upload/ config.php sudo chmod 770 store/ cache/ files/ |
Finish installation
Now, your phpBB installation is almost over. The software is finally ready to be installed. Launch phpBB on the web browser:
1 |
http://server _ip/install |
Then, go to the “INSTALL” tab:
If it shows errors like missing PHP extensions (XML, mbstring, etc.), then open a terminal, and install the following additional packages:
Once installed, restart the Apache web-server and click “Retest requirements:”
1 2 |
sudo apt install php-xml php-mbstring sudo systemctl restart apache2 |
The next step will ask for the admin username and password for phpBB. An admin of a board holds all the powers, including fine-tuning board settings, user management, etc. For in-depth information about phpBB administration, check out the phpBB administration guide.
After that, PhpBB will ask for the necessary data and credentials. The fields will look something like this:
- Database type: MySQL with MySQLi extension
- Database server hostname or DSN: localhost
- Database name: phpBB
- Database username: cloudsigma
- Database password: password123
Next, click “Submit” to continue the installation. For all the consequential steps, verify the values and click “Submit:”
Finally, the installation should be complete!
Cleanup
As now your phpBB installation is complete, it’s time to clean up some residues. First, remove some permissions from the config.php file:
1 |
sudo chmod 640 /var/www/html/config.php |
Then, delete the /var/www/html/install
directory. Otherwise, phpBB won’t function and show a warning message:
1 |
sudo rm -rf /var/www/html/install |
Access phpBB
PhpBB should be accessible from the server’s IP address or domain:
1 |
http://server_ip/ |
Final thoughts
In this tutorial, we showed you a step-by-step overview of the process to install phpBB forums on Ubuntu 20.04. Installing phpBB for the first time will take a bit of time. However, the installation itself is a simple process.
Happy computing!
- Removing Spaces in Python - March 24, 2023
- Is Kubernetes Right for Me? Choosing the Best Deployment Platform for your Business - March 10, 2023
- Cloud Provider of tomorrow - March 6, 2023
- SOLID: The First 5 Principles of Object-Oriented Design? - March 3, 2023
- Setting Up CSS and HTML for Your Website: A Tutorial - October 28, 2022