Setting up a forum website with MyBB in Debian

MyBB, formerly known as MyBulletinBoard, is a flexible, free, open-source CMS that can be used to set up online forum portals or discussion boards. The application software is written in PHP programming language and can interact with several RDBMS databases – MySQL, SQLite and PostgreSQL databases – as a backend for data storage. Often MyBB CMS is used on Linux with Apache or Nginx web servers, PHP server-side programming language and MySQL/MariaDB database management system.

This step-by-step guide describes how to install and configure the latest version of the phpBB3 platform on Debian 11 – with Apache HTTP server and MariaDB database as backend – to create an online forum website for the Internet or intranets.

The following requirements must be met in order to deploy the MyBB application on your premises properly.

  • A bare metal server, virtual machine, or VPS running the latest version of the Debian 11 Linux distribution is installed with minimal software packages.
  • Root account privileges on the Debian server or an account with root privileges. These accounts must be locally accessible from the server console or remotely accessible via SSH.
  • A server network interface card configured with a static IP address or a DHCP server configured to assign a static IP address for the network interface based on the MAC address.
  • A publicly registered domain name so that visitors can browse the Internet. If setting up the forum on an intranet, add the appropriate DNS records to the local DNS server. In intranets, the site can also be accessed using the IP address of your server.
  • A mail service set up at your site to use forum account registration via an email address or other custom features that require a mail server. If the forum website is visible online, you can use a public mail service to achieve the same goal.


The first step is logging into your server console and running the following commands to ensure your system has the latest security patches, kernel and software versions.

apt update
apt upgrade

In the next step, configure the name of your machine by entering the following command. Replace the hostname used in these instructions with your own domain name.

hostnamectl set-hostname

To verify that the machine name is configured correctly, run the following commands.

cat /etc/hostname
hostname –s
hostname –f

The initial step is to reboot the machine to apply the hostname changes and kernel upgrades.

systemctl reboot

After the reboot, log in to the server console with the root account or a user with root privileges obtained with the sudo utility and run the following command to install some necessary packages to download software from the Internet and unzip archives.

apt install wget zip unzip curl

This tutorial will install the MyBB Web CMS application on a LAMP stack. The first components of the LAMP software package that we will install on our Debian server are the Apache HTTP server and the PHP interpreter. To install Apache and all the necessary PHP extensions to make MyBB CMS run properly, enter the following command in your server console.

apt install apache2 libapache2-mod-php7.4 php7.4 php7.4-gd php7.4-opcache php7.4-mbstring php7.4-xml

After installing the PHP software packages in your system, open the PHP configuration file and change the following PHP variables as described below.  Open the /etc/php/7.4/apache2/php.ini file with your favorite command line text editor, such as nano, and change the following lines. Also, make sure you back up the original PHP configuration file.

cp /etc/php/7.4/apache2/php.ini{,.backup}
nano /etc/php/7.4/apache2/php.ini

 Search, edit, and change the following variables in the php.ini configuration file:

file_uploads = On
default_charset = UTF-8
memory_limit = 128M
upload_max_filesize = 100M
date.timezone = Europe/London

In the following excerpt, you need to replace the timezone variable to match the computer’s geographic location. Check the official PHP timezone list to determine your current location. You can find the PHP timezone settings at the following URL:

The upload_max_file_size variable can be adjusted to get an upper file upload size that is best suited to support large file attachments on your website.

Also, you should make sure that you enable the OPCache plugin for PHP7 to increase the loading speed of your website. To enable the OPCache extension in the PHP7 interpreter, you need to add the following lines in the PHP default configuration file under the [opcache] statement line, as described below:


To verify that the OPCache settings have been correctly added to the php.ini configuration file, run the following command

grep opcache /etc/php/7.4/apache2/php.ini| grep -v ";"

The next step is to enable Apache’s rewrite module to use the .htaccess files and change the server and site configuration on-the-fly by entering the following command

a2enmod rewrite

In the next step, you need to enable Apache TLS configuration to install and browse the forum securely using HTTPS protocol.

This setting ensures that traffic between the server and clients is encrypted. To enable Apache TLS configuration, first, enable the SSL module and the SSL site configuration file with the following commands.

a2enmod ssl
a2ensite default-ssl.conf

After you have enabled TLS configuration, open the Apache default SSL site configuration file with a text editor and add the following URL rewrite rules after the DocumentRoot directive, as shown in the following excerpt. This setting allows the Apache web server to read and apply the .htaccess file rules stored in your domain’s webroot path.

nano /etc/apache2/sites-enabled/default-ssl.conf

 SSL site configuration file excerpt:

<Directory /var/www/html>
  Options +FollowSymlinks
  AllowOverride All
  Require all granted

You may also want to enable the rewrite rules of the Apache non-SSL conf file. We will enable the rewrite configuration for the non-TLS configuration file to redirect unencrypted HTTP requests to HTTPS. So, open the /etc/apache2/sites-enabled/000-default.conf file with a text editor and add the lines of code for the rewrite rules after the DocumentRoot statement, as shown in the following example.

<Directory /var/www/html>
  Options +FollowSymlinks
  AllowOverride All
  Require all granted

Finally, restart the Apache daemon to apply all the rules configured so far, and call your domain name or the IP address of the server from a remote desktop machine using the HTTP protocol to get the default web page of the Apache web server. To display the server’s IP address, run the ifconfig or ip a commands. For now, you can’t automatically redirect to HTTPS connections because there is no .htaccess file with the correct rules stored in the root of your web page document.

systemctl restart apache2


If you can’t reach the Apache default website from a remote machine, check your server configuration to see if you have a firewall enabled on your system. If so, you should add a new rule that allows HTTP and HTTPS traffic through the firewall by entering the following command. The following commands only apply if the UFW firewall application is installed and active on your machine.

ufw allow 'WWW Full'


ufw allow 80/tcp
ufw allow 443/tcp

If you want to use iptables raw rules to manage the server firewall in your Debian server, add the following rules to allow ports 80 and 443 TCP inbound traffic on the firewall to allow external visitors to visit the website.

apt-get install -y iptables-persistent
iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT
iptables -I INPUT -p tcp --destination-port 443 -j ACCEPT
iptables -I INPUT -p tcp --destination-port 22 -j ACCEPT
netfilter-persistent save
systemctl restart netfilter-persistent
systemctl status netfilter-persistent
systemctl enable netfilter-persistent.service

After applying the firewall rules, you should be able to successfully browse your domain and access the Apache default website. Also check if you can browse your domain name over HTTPS by writing the following URL in your browser’s address field.


Since you are using the self-signed certificate pairs issued automatically by Apache during installation, which are not trusted by the browser, a warning message should be displayed in the browser.

Accept the warning to accept the untrusted certificate and continue to be redirected to the default Apache web page, as shown in the following figure.



Finally, create a PHP info file in your domain’s webroot by running the following command.

echo '<?php phpinfo(); ?>'| tee /var/www/html/info.php

Call the PHP info script file in a browser by navigating to the following URL address.


This script provides information about the PHP interpreter installed in your system. To view the PHP time zone settings, scroll down to the Date setting, as shown in the following image.


The last LAMP component needed to deploy the MyBB web application is the RDMBS database. In this guide, we install MyBB CMS using MariaDB as the backend database. The application uses the database to store website configurations, users, sessions, contacts, and other information. To install the MariaDB database server, the database client and the PHP module for accessing the MySQL database, enter the following command in your server console.

apt install mariadb-server mariadb-client php7.4-mysql

After installing the MariaDB database server in your system, log into the MySQL console and set up the MariaDB root account plugin by entering the following commands. This will force the MySQL server to ask for a password when you log in to the database console with the built-in root account.

mysql -h localhost

MariaDB [(none)]> use mysql;

Read table information to complete table and column names
You can turn this feature off with -A
Database modified

to get a faster startup.

MariaDB [mysql]> update user set plugin=” where user=’root’;

Query OK, 1 row affected (0.00 sec)
Lines matched: 1  Modified: 1  Warnings: 0

MariaDB [mysql]> flush privileges;

Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> exit

Next, you need to further secure the MariaDB daemon by running the script mysql_secure_installation. The script will ask you questions about changing the MySQL root password, removing anonymous users, disabling remote root logins and deleting the test database. To complete the configuration, answer “yes” to all questions and choose a secure password for the database root account.


Test the root account:

mysql -h localhost -u root -p
Enter password:

MariaDB [(none)]> exit


Install MyBB on Debian

After all LAMP components are installed and properly configured in your system, visit the official MyBB download page at and download the latest zip archive into your system using the wget utility by running the following command. Execute the ls command to display the archive name.


After completing the zip archive download, unzip the MyBB zip archive file to your current working directory and list the unzipped files using the following commands.


 Also, remove the default index.html file installed by the Apache web server from the webroot path and delete the info.php file created earlier by running the following command.

rm /var/www/html/{index.html,info.php}

The installation files for MyBB are located in your current working directory in the Upload/ directory. Issue the ls command to list the files in that directory. You need to copy the entire contents of the Upload/ directory to your domain’s webroot path by running the following command.

cp -rf Upload/* /var/www/html/

Finally, grant the Apache runtime user full write permissions to the domain webroot path by running the following command. Execute the ls command to list the permissions for the application’s installed files in the /var/www/html/ directory.

chown -R www-data:www-data /var/www/html/
ls –al /var/www/html/

Before you start installing MyBB via the web interface, log into the MariaDB database console and create the application’s database. Also, create a database account and specify a secure password for this account. This database account will be used exclusively for managing the MyBB application database. Use the following commands to create the database and database user account, and replace the database name and credentials accordingly.

mysql –u root -p
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Type 'help;' or '\h' for help. Type '\c' to delete the current input statement.

MariaDB [(none)]> create database myforum_db;

Query OK, 1 line affected (0.00 sec) 

MariaDB [(none)]> grant all privileges on myforum_db.* to 'forum_user'@'localhost' identified by 'password1234';

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit


After creating the database, start the installation process by opening a browser and navigating to your server’s IP address, domain name, or FQDN using the HTTPS protocol.


On the initial welcome screen, the MyBB installer will display a summary of the installation process and the steps needed to complete the installation. Uncheck the “Send anonymous statistics about your server specifications to the MyBB group”  checkbox and click the Next button to start the installation process, as shown in the following figure.

Next, read the software license agreement and click the “Next” button to accept the license terms and proceed to the next installation step.

In the next step, the MyBB application installer will check your system to see if all the application installation requirements are met. If all the requirements from the list are met, click the Next button to start the web configuration, as shown in the screenshot below.

On the next installation screen, select MySQL Improved as the database engine and specify the hostname of the MySQL database server (localhost in this guide), the username and password for accessing the MyBB database, and the database name created for installing the application. Also add a database table prefix and table encoding (use UTF-8 Unicode) and click the Next button to proceed to the next installation screen, as shown in the screenshot below.

In the next installation screens, click on the Next button after the database table is created to move to the next installation screen.

After importing the database schema, click the Next button to populate the database with the default data.

The installer loads and imports the application theme and template file on the next screen. When the process is complete, click the Next button to continue.

On the next screen, configure the basic settings of your forum website. Add a name for your forum and website, and check that the URL variables are properly recognized to redirect to your domain name using the HTTPS protocol. Check the cookie domain setting and cookie path and add a contact email address. Leave the ACP PIN blank and click Next to continue, as shown in the following image.

On the next installation screen, add an administrator account and a secure password for the administrator account. Provide an email address for the administrator account and click the Next button to complete the installation process.

On completion of the installation process, the installer will display a green message informing you that “the MyBB application has been successfully installed and correctly configured”  The installer will automatically lock the installation directory.  To access the MyBB dashboard, click on the Admin Control Panel link and you will be automatically redirected and authenticated to the MyBB dashboard.

But before logging into the MyBB-Backed admin panel, you must first return to the server console and run the following command to delete the installation directory.

rm -rf /var/www/html/install/

Visit the MyBB Admin Control Panel by navigating to your server IP address or domain name via the HTTPS protocol to the URL path /admin/. Use the credentials you set during installation to log in to the backend, as shown in the screenshot below.


To force HTTPS transactions in the MyBB frontend and backend, you need to create and edit the .htaccess file in the root directory of your website by entering the following commands.

cp /var/www/html/htaccess.txt /var/www/html/.htaccess
nano /var/www/html/.htaccess

Add the following lines to the beginning of the file to redirect clients to HTTPS.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

To change the native PHP server settings, such as file upload size, add the following lines to the .htaccess file, as shown in the following file excerpt. Adjust these settings to suit your own server resources and configurations.

php_value upload_max_filesize 300M
php_value post_max_size 300M

To visit the MyBB frontend website, navigate to your server IP address or domain name using the HTTP protocol. Your connection should be automatically switched to the HTTPS protocol.


That’s all! You have successfully installed the MyBB forum application in Debian 9. Consider buying a certificate issued by a trusted certificate authority, or get a free pair of certificates through Let’s Encrypt CA if the forum application is made available to visitors on the Internet.

The MyBB documentation page can be viewed at the following address: