Debian 13 Flarum 2.0.0 beta7 Install with Postgresql
I’m offering a “cheat sheet” of sorts to make it easy for potential Flarum testers/developers to quickly install a working Flarum.
The below text is not simply a script you run (it’s not for total Linux noobs), but rather read the comments line by line, taking your time. Then cut and paste the lines as commands to execute, having understood and grasped what you’re about to do. Ideally you’d be doing this in some sort of Linux container (LXC? incus? etc), which permits you to make “snapshots” as you go, so you can “roll back” to a previous snapshot, if you make a mistake. Snapshots are sort of like “save points” in a video game.
The below text can be saved directly from here, to avoid any formatting artifacts that might “pollute” the plain text (were you to just copy and paste from below):
####Flarum 2.0.0beta7 download and install *for Debian 13*. Postgresql will be the db.
# Is loosely based on:
# https://docs.flarum.org/2.x/install
# your normal unix user has sudo privs, right? You'll be needing those...
# As your normal user (not root):
sudo apt update
sudo apt install -y tmux magic-wormhole nginx php-cli php-fpm php-mysql php-xml php-gd php-json php-mbstring php-zip php-curl php-pgsql ne postgresql composer
### -- good time for a snapshot
# start postgres SQL shell:
sudo -u postgres psql
CREATE USER flarumuser WITH PASSWORD 'yourpassword';
CREATE DATABASE flarum OWNER flarumuser;
GRANT ALL PRIVILEGES ON DATABASE flarum TO flarumuser;
exit
sudo mkdir /var/www/compos -p
# Note: you'll later on end up with /var/www/compos/flarum/.nginx.conf
# This is normal: composer would like to exclusively write its own state
# files in that first /var/www/compos folder
sudo chown -R www-data:www-data /var/www/compos
sudo chmod 775 -R /var/www/compos
# Initial flarum install is into /var/www/compos/, not /var/www/compos/flarum/
cd /var/www/compos
### good time for a snapshot
# This installed flarum 2.0.0-beta.7:
sudo COMPOSER_HOME=/var/www/compos/ -u www-data composer create-project flarum/flarum:^2.0.0 --stability=beta
# show what composer installed inside the new flarum folder
# NOTE: this is done in /var/www/compos/flarum/, *not* /var/www/compos/
cd /var/www/compos/flarum
sudo COMPOSER_HOME=/var/www/compos/ -u www-data composer show
sudo cp /etc/php/8.4/fpm/php.ini /root/etc_php_8.4_fpm_php.ini.orig
sudo sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 8M/g' /etc/php/8.4/fpm/php.ini
sudo diff /etc/php/8.4/fpm/php.ini /root/etc_php_8.4_fpm_php.ini.orig
sudo systemctl restart php8.4-fpm
#### nginx configuration:
## put an nginx conf into place, in /etc/nginx/sites-available/:
## I'm not holding your hand to put a working nginx conf into place. That's on you! Or ask me to help you for a fee.
## The upstream example is here:
# https://docs.flarum.org/install/
cd /etc/nginx/sites-available/
## ... I created it myself, and called it "flarum"
# Uncomment hash bucket size 64:
sudo cp /etc/nginx/nginx.conf /root/etc_nginx_nginx.conf
sudo sed -i 's/# server_names_hash_bucket_size 64/server_names_hash_bucket_size 64/g' /etc/nginx/nginx.conf
sudo diff /etc/nginx/nginx.conf /root/etc_nginx_nginx.conf
cd ../sites-enabled/
sudo ln -s ../sites-available/flarum flarum
sudo nginx -t
### You should very probably delete the default, boilerplate Debian nginx conf:
### sudo rm default
sudo systemctl restart nginx.service
##Visit in browser (or some other appropriate URL, having set up your nginx conf appropriately):
# NOTE: IDEALLY you would be using SSL, an SSH tunnel, Wireguard or some other form of encryption!!
# Please don't enter passwords "in the clear"! It's bad "security hygiene":
http://yourhostname.lan/
#You should see the one-time Flarum setup web page.
### -- a great time for a snapshot
## Once db, etc, connected, and it says "It looks as though there are no discussions here.",
# That's another good time for a snapshot
#To install more Flarum extensions:
sudo systemctl stop php8.4-fpm.service
# NOTE: extensions are installed from /var/www/compos/flarum/, *not* /var/www/compos/
cd /var/www/compos/flarum/
sudo COMPOSER_HOME=/var/www/compos/ -u www-data composer require fof/links:"*"
# some other possible extensions:
fof/socialprofile
fof/ignore-users
fof/moderator-warnings
fof/reactions
fof/frontpage
fof/split:"*"
fof/upload:"*"
sudo systemctl start php8.4-fpm.service
## Note: obsoleted in 2.0, "database-queue" merged into Flarum core:
## flarum-com/database-queue:"*"
#### Enable database queue
## change 'driver' from 'sync' to 'database' in /var/www/compos/flarum/config.php (line 26), and restart the
## php8.4-fpm systemd service.
# Now it shows as database as queue driver in web admin iface. See screenshot:
# https://discuss.flarum.org/d/38659-database-queue-working-with-postgresql-for-the-20-beta/29
cd /var/www/compos/flarum/
sudo -u www-data php flarum schedule:run
# https://docs.flarum.org/2.x/scheduler
## Then they want a cronjob for: sudo -u www-data php flarum schedule:run
sudo apt update
sudo apt install cron
# I, for one, like the "ne" editor:
EDITOR=ne crontab -e
# Pasting this line at the bottom, then save and exit:
* * * * * cd /var/www/compos/flarum && /usr/bin/sudo -u www-data /usr/bin/php /var/www/compos/flarum/flarum schedule:run >> /dev/null 2>&1
Note: none of this is vibe-coded. Neither AI, nor LLMs were used to make any of this.
This was cross-posted at the Flarum forum here.