Skip to main content

BookStack: Wiki Setup on Ubuntu 24.04

πŸ“„ Description:

This page documents the complete process for installing BookStack, a self-hosted wiki and knowledge base, on a fresh Ubuntu 24.04 server using PHP, Nginx, and MariaDB. This service is used as my primary knowledge repository.

ref. https://www.bookstackapp.com/docs/admin/installation/

βœ… Prerequisites

  • Fresh Ubuntu 24.04 LTS server (minimal install) LXC

  • Root or sudo access

  • Static IP address

Ubuntu 24.04 Installation Script

A script to install BookStack on a fresh instance of Ubuntu 24.04 is available. This script is ONLY FOR A FRESH OS it will install Apache, MySQL 8.0 & PHP 8.3 and could OVERWRITE any existing web setup on the machine. It also does not set up mail settings or configure system security, so you will have to do those separately. You can use the script as a reference if you’re installing on a non-fresh machine.

Running the Script

# Ensure you have read the above information about what this script does before executing these commands.

# Download the script
wget https://codeberg.org/bookstack/devops/raw/branch/main/scripts/installation-ubuntu-24.04.sh

# Make it executable
chmod a+x installation-ubuntu-24.04.sh

# Run the script with admin permissions
sudo ./installation-ubuntu-24.04.sh

The script will output a log file for debugging within your current working directory when running the script. Permissions for the BookStack installation files & folders will be set based on the user used to run the script.

βœ… Change your BookStack instance URL

1. Set up a domain name (DNS)

Make sure that wiki.example.com points to your server's public IP address (private/internal). In my case, I used Cloudflare tunnel.

2. Configure BookStack's .env

Edit the BookStack environment file to reflect the new domain:

sudo nano /var/www/bookstack/.env

Update this line:

APP_URL=https://wiki.example.com

Then restart the web server:

sudo systemctl restart apache2

βœ… Set up HTTPS with Let's Encrypt (Optional but Recommended)

Install Certbot:

sudo apt install certbot python3-certbot-apache
sudo certbot --apache -d wiki.example.com

 

It will automatically get and install the SSL certificate.

βœ… Step-by-Step Mail Setup

1. Edit the .env File

Open the BookStack environment config:

sudo nano /var/www/bookstack/.env

Look for or add the following section:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="BookStack"

πŸ” Replace the values depending on your email provider.

2. Clear the config Cache (optional but recommended)


cd /var/www/bookstack
php artisan config:clear