phpBB, also known as a “PHP Bulletin Board” is a free flat-forum bulletin board software that provides a space for people to gather and communicate with each other. It is written in PHP and supports many database engines including, MySQL, Oracle Database, SQLite, PostgreSQL, etc. It comes with hundreds of style and image packages that help you to customize your board.
In this post, we will show you how to install phpBB on Ubuntu 20.04.
Table of Contents
Prerequisites
- A Ubuntu 20.04 VPS with root access enabled or a user with sudo privileges.
Log in via SSH and Update your System
First, you will need to log in to your Ubuntu 20.04 VPS via SSH as the root user:
ssh root@IP_ADDRESS -p PORT_NUMBER
Next, run the following commands to upgrade all installed packages on your VPS:
apt-get update -y
Once all the packages are updated, restart your system to apply the changes.
Install Apache, PHP and MariaDB
First, you will need to install the Apache, MariaDB, PHP, and other required PHP extensions to your server. Run the following command to install all the packages:
apt-get install apache2 mariadb-server libapache2-mod-php php-gd php-curl openssl php-imagick php-intl php-json php-ldap php-common php-mbstring php-mysql php-imap php-sqlite3 php-net-ftp php-zip unzip php-pgsql php-ssh2 php-xml unzip -y
After installing all the packages, start the Apache and MariaDB service using the command given below:
systemctl start apache2 systemctl start mariadb
Create a Database and User for phpBB
Now, you will need to create a database and user for phpBB. First, log in to the MariaDB with the following command:
mysql
Once you are log in, create a database and user with the following command:
MariaDB [(none)]> CREATE DATABASE phpbb; MariaDB [(none)]> GRANT ALL ON phpbb.* to 'phpbb'@'localhost' IDENTIFIED BY 'securepassword';
Next, flush the privileges and exit from the MariaDB with the following command:
MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> EXIT;
Download and Configure phpBB
First, go to the phpBB official download page and download the latest version of phpBB using the following command:
wget https://download.phpbb.com/pub/release/3.3/3.3.5/phpBB-3.3.5.zip
Once the download is completed, unzip the downloaded file with the following command:
unzip phpBB-3.3.5.zip
Next, move the extracted directory to the Apache web root directory:
mv phpBB3 /var/www/html/phpbb
Next, change the ownership and permission of the phpBB directory:
chown -R www-data:www-data /var/www/html/phpbb chmod -R 755 /var/www/html/phpbb
Create an Apache Virtual Host for phpBB
Next, you will need to create an Apache virtual host configuration file to host the phpBB on the internet.
nano /etc/apache2/sites-available/phpbb.conf
Add the following configuration:
<VirtualHost *:80> ServerAdmin admin@phpbb.example.com DocumentRoot /var/www/html/phpbb ServerName phpbb.example.com <Directory /var/www/html/phpbb> Options FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/phpbb_error.log CustomLog ${APACHE_LOG_DIR}/phpbb_access.log combined </VirtualHost>
Save and close the file then activate the phpBB virtual host and Apache rewrite module with the following command:
a2ensite phpbb a2enmod rewrite
Finally, restart the Apache service to apply the changes.
systemctl restart apache2
You can also check the status of the Apache using the following command:
systemctl status apache2
You will get the following output:
● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2022-02-10 12:04:28 UTC; 6s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 17047 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 17065 (apache2) Tasks: 6 (limit: 2348) Memory: 14.8M CGroup: /system.slice/apache2.service ├─17065 /usr/sbin/apache2 -k start ├─17066 /usr/sbin/apache2 -k start ├─17067 /usr/sbin/apache2 -k start ├─17068 /usr/sbin/apache2 -k start ├─17069 /usr/sbin/apache2 -k start └─17070 /usr/sbin/apache2 -k start Feb 10 12:04:27 ubuntu2004 systemd[1]: Starting The Apache HTTP Server...
Finalizing the phpBB Installation
At this point, Apache virtual host is configured to serve the phpBB. Now, open your web browser and access the phpBB web installation wizard using the URL http://phpbb.example.com/install. You will be redirected to the following page:
Click on the Install button to start the installation. You should see the Administrator configuration page:
Provide your admin username and password, and click on the Submit button. You should see the database configuration page:
Provide your database information and click on the Submit button. You should see the server configuration page:
Provide the protocol, website URL, port, and click on the Submit button. You should see the email configuration page:
Provide your desired options and click on the Submit button. You should see the board configuration page:
Select the language, type board name, and description, and click on the Submit button. Once the installation has been finished, you should see the following page:
Click on the Take me to the ACP button. You should see the phpBB dashboard on the following page:
Of course, if you are one of our Ubuntu Hosting customers, you don’t have to install phpBB on your Ubuntu 20.04 VPS – simply ask our admins, sit back, and relax. Our admins will install phpBB on Ubuntu 20.04 for you immediately.
PS. If you liked this post about how to install phpBB on Ubuntu 20.04 VPS, please share it with your friends on the social networks using the buttons below, or simply leave a comment in the comments section. Thanks.
Could not connect to the database, see error message below.
Access denied for user ‘phpbb’@’localhost’ (using password: YES)
You should check if you are using the correct password for the database user ‘phpbb’.