Developer-Dude π¨π¦ Here's how:
Yes β you can run a fully local Flarum forum on your laptop just for testing.
Say you have a Ubuntu OS.Just install Apache2 and MySQL database on your laptop. It only runs when you start Apache and MySQL. No public server needed.
Easy local setup (Ubuntu + Apache2 + MySQL)
1. Install everything
sudo apt update
sudo apt install apache2 mysql-server php php-cli php-mysql php-xml php-mbstring php-curl php-gd php-zip php-tokenizer php-fileinfo php-dom composer git -y
2. Enable Apache modules and start services
sudo a2enmod rewrite
sudo systemctl enable --now apache2 mysql
3. Create a MySQL database
sudo mysql
Inside MySQL:
CREATE DATABASE flarum;
CREATE USER 'flarum'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON flarum.* TO 'flarum'@'localhost';
FLUSH PRIVILEGES;
EXIT;
4. Install Flarum
sudo mkdir -p /var/www/flarum
sudo chown -R $USER:www-data /var/www/flarum
cd /var/www/flarum
composer create-project flarum/flarum:^2.0.0 --stability=beta .
5. Configure Apache
Create a simple virtual host:
sudo nano /etc/apache2/sites-available/flarum.conf
Paste this:
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/flarum/public
<Directory /var/www/flarum/public>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/flarum-error.log
CustomLog ${APACHE_LOG_DIR}/flarum-access.log combined
</VirtualHost>
Enable it and restart Apache:
sudo a2dissite 000-default
sudo a2ensite flarum
sudo systemctl restart apache2
6. Fix permissions
sudo chown -R www-data:www-data /var/www/flarum
sudo chmod -R 775 /var/www/flarum/storage /var/www/flarum/public/assets
7. Finish installation
Open your browser and go to:
http://localhost
Follow the web installer (enter the database name flarum, user flarum, password you chose, and create your admin account).
Thatβs it β you now have a local Flarum forum that only runs when Apache and MySQL are running.
This is the easiest clean way on Ubuntu with Apache2 + MySQL. Enjoy testing and contributing!