Installing the MyBB Forum on Ubuntu/Debian: A No‑BS Guide
In this quick walk‑through you’ll learn how to get a fresh MyBB Forum up and running on an Ubuntu or Debian server, from installing the LAMP stack to setting the right permissions so that your users can post without tripping over a 403 error. If you’re tired of endless “missing extensions” posts in forums, this is the place.
Prerequisites
Before diving into code, make sure your machine has at least Ubuntu 20.04 LTS or Debian 11 installed and that you have root or sudo access. I’ve seen folks stumble on this step when they forget to update their package index first, so run:
sudo apt update && sudo apt upgrade -y
This pulls in the latest security patches and ensures your repositories are fresh.
Installing Apache, PHP, and MySQL
MyBB runs best with PHP 8.x. Install the core stack with one command:
sudo apt install apache2 php php-mysql libapache2-mod-php mysql-server -y
If you skip libapache2-mod-php, Apache won’t be able to interpret PHP files at all, and MyBB will never load. Also, installing mysql-server in the same line avoids a second prompt where you might forget to set the root password.
Creating a Database and User
MyBB needs its own database. Log into the MySQL console:
sudo mysql -u root -p
Then run:
CREATE DATABASE mybb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; GRANT ALL PRIVILEGES ON mybb.* TO 'mybbuser'@'localhost' IDENTIFIED BY 'StrongPassword123'; FLUSH PRIVILEGES; EXIT;
I’ve seen people use the default root user for forum installations, which is a security no‑no. Create a dedicated user instead.
Downloading and Unpacking MyBB
Grab the latest release from the official site:
cd /tmp wget https://sourceforge.net/projects/mybboard/files/latest/download -O mybb.zip unzip mybb.zip -d /var/www/html/
Move the contents into a sub‑folder for clarity, e.g., /var/www/html/forum:
sudo mv /var/www/html/* /var/www/html/forum/ && rmdir /var/www/html/
Why not keep everything in the root? It keeps Apache’s DocumentRoot tidy and makes it easier to point a virtual host later.
Setting Permissions
MyBB writes logs, uploads, and caches. The web server user (www-data) must own these directories:
sudo chown -R www-data:www-data /var/www/html/forum/
sudo find /var/www/html/forum/ -type d -exec chmod 755 {} \;
sudo find /var/www/html/forum/ -type f -exec chmod 644 {} \;
A common mistake is to leave the attachments folder writable by everyone (chmod 777). That opens you up to malicious uploads, so keep it tight.
Running the Installer in a Browser
Open your browser and navigate to:
http://your_server_ip/forum/
You should see MyBB’s welcome screen. Click “Start Install,” then fill out the form with the database credentials you created earlier. If you hit “Unable to connect to the database,” double‑check that mybbuser can log in from localhost and that your password matches exactly.
Troubleshooting Common Errors
- Error 500 – PHP Fatal error
Usually caused by a missing PHP extension. On Ubuntu 22.04 I ran into this when the installer couldn’t find php-curl. Fix it with:
sudo apt install php-curl
- “Table already exists” during installation
Happens if you accidentally run the installer twice. Drop the tables first or start over.
- Cannot upload files
If MyBB complains about writing to /attachments, verify permissions again and ensure tmp directories exist and are writable.
Wrap‑Up
You’ve now got a fresh MyBB Forum on Ubuntu/Debian, ready for your first post.