phpBB is free and open-source bulletin board software that allows you to stay in touch with a group of people. It can power your entire website and provide a space for people to gather and communicate with each other. It provides a web-based interface where people can post topics, and other people can reply to those topics. With phpBB, you can assign roles, create roleplaying lists, enable special permissions, send newsletters to your community, and create custom content. If you want to create forum-style discussion boards, then phpBB is a great tool for you.
This post will show you how to install phpBB with Apache and Let’s Encrypt SSL on Debian 11.
Prerequisites
- A Debian 11 server installed on your system.
- A valid domain name is pointed with your server IP.
- A root password is configured on the server.
Install LAMP Server
phpBB is written in PHP and uses MariaDB as a database backend. So, you will need to install the Apache webserver, MariaDB database server, PHP, and other packages to your server. You can install all of them by running the following command:
apt install apache2 mariadb-server php 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 wget unzip -y
After installing all the packages, you can start and enable the Apache service with the following command:
systemctl start apache2
systemctl enable apache2
Configure MariaDB Database
Next, you will need to create a database and user for phpBB. First, log in to the MariaDB shell with the following command:
mysql
Once you are logged in, create a database and user with the following command:
MariaDB [(none)]> CREATE DATABASE phpbbdb;
MariaDB [(none)]> GRANT ALL ON phpbbdb.* to 'phpbbuser'@'localhost' IDENTIFIED BY 'password';
Next, flush the privileges and exit from the MariaDB with the following command:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
Once you are done, you can proceed to the next step.
Install phpBB Debian 11
First, visit the phpBB official website and download the latest version of phpBB with the following command.
wget https://download.phpbb.com/pub/release/3.3/3.3.9/phpBB-3.3.9.zip
After the successful download, unzip the downloaded file with the following command:
unzip phpBB-3.3.9.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 775 /var/www/html/phpbb
Once you are done, you can proceed to the next step.
Create an Apache Virtual Host for phpBB
Next, you will need to create an Apache virtual host configuration file to host phpBB. You can create it with the following command:
nano /etc/apache2/sites-available/phpbb.conf
Add the following lines:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/phpbb ServerName phpbb3.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 when you are finished. Then, enable the Apache virtual host and 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 service 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 Fri 2022-12-30 04:44:52 UTC; 5s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 17472 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 17476 (apache2) Tasks: 6 (limit: 4675) Memory: 16.4M CPU: 108ms CGroup: /system.slice/apache2.service ??17476 /usr/sbin/apache2 -k start ??17477 /usr/sbin/apache2 -k start ??17478 /usr/sbin/apache2 -k start ??17479 /usr/sbin/apache2 -k start ??17480 /usr/sbin/apache2 -k start ??17481 /usr/sbin/apache2 -k start Dec 30 04:44:52 debian11 systemd[1]: Starting The Apache HTTP Server...
At this point, phpBB is installed with the Apache web server. You can now proceed to access the phpBB web UI.
Access phpBB Web Interface
Now, open your web browser and access the phpBB web UI using the URL http://phpbb3.example.com. You should see the following page:
Click on the INSTALL tab. You should see the following page.
Now, click on the Install button to start the installation. You should see the following page:
Set your admin username, password then click on the Submit button. You should see the following page:
Define your database host, port, database name, username, password, and click on the Submit button. You should see the following page:
Define your protocol, website domain name, port, path and click on the Submit button. You should see the following page:
Type your SMTP details and click on the Submit button. You should see the following page:
Select your language, board name, board description and click on the Submit button. You should see the following page:
Click on the Take me to the ACP button. You should see the phpBB control panel on the following page:
Enable SSL on phpBB Forum
To enable SSL on your website, you will need to install the Certbot client on your server.
First, install the Snap package manager with the following command:
apt install snapd
Next, update the Snap package to the latest version:
snap install core
snap refresh core
Next, install the certbot package using the following command:
snap install --classic certbot
Next, create a symbolic link for the Certbot binary to the system location:
ln -s /snap/bin/certbot /usr/bin/certbot
Next, run the following command to download and install Let’s Encrypt SSL certificates:
certbot --apache -d phpbb.example.com
You will be asked to provide your email and accept the term of service as shown below:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [email protected] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must agree in order to register with the ACME server. Do you agree? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing, once your first certificate is successfully issued, to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y
Type Y and press the Enter key to download and install the SSL certificates for your domain:
Account registered. Requesting a certificate for phpbb.example.com Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/phpbb.example.com/fullchain.pem Key is saved at: /etc/letsencrypt/live/phpbb.example.com/privkey.pem This certificate expires on 2023-03-29. These files will be updated when the certificate renews. Certbot has set up a scheduled task to automatically renew this certificate in the background. Deploying certificate Successfully deployed certificate for phpbb.example.com to /etc/apache2/sites-available/phpbb.conf Congratulations! You have successfully enabled HTTPS on https://phpbb.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If you like Certbot, please consider supporting our work by: * Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate * Donating to EFF: https://eff.org/donate-le - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Now, you can access your website securely using the URL https://phpbb.example.com.
Conclusion
In this post, we explained how to install phpBB with Apache and Let’s Encrypt SSL on Debian Linux. You can now use phpBB to create forum-style discussion boards in your organization. Feel free to ask me if you have any questions.