Skip to content

Set Up BookStack on a Linux Server – Your Own Wiki for Documentation and Knowledge

BookStack on a Linux server: as a One-Click App with your own admin login or with Docker Compose, with shelves, books, roles, SMTP and backups.

1 December 202613 min read1 Views0 helpful

Introduction

BookStack is a self-hosted wiki for documentation and knowledge. Organize content like a library: shelves contain books, books contain chapters and pages. Write pages in a WYSIWYG editor or in Markdown, with images, attachments, tables, and diagrams. Every change is saved as a revision in the history, and full-text search finds content across all books. Use roles to define who can read and edit what. BookStack is a PHP application based on Laravel and stores everything in a MariaDB database.

In this guide, we show you two ways to get started: the easy way with a One-Click App, which makes BookStack available over HTTPS in just a few minutes, and a manual installation with Docker Compose. After that, you’ll build your wiki’s structure, invite colleagues, and configure email delivery.

When BookStack Makes Sense on a VPS

BookStack is a good fit wherever you need to collect and maintain knowledge in one place. It’s worth using on a VPS if:

  • You want to create internal documentation for your team, club, or community, such as guides, processes, or server documentation.
  • You need a clear structure instead of scattered notes. Shelves, books, and chapters provide a fixed structure, even for large collections.
  • You want to keep your data with you instead of storing it with a cloud service. The database and uploads are stored on your server.
  • Multiple people need to work with different permissions. BookStack comes with roles such as Admin, Editor, and Viewer, and you can add your own.
  • You’re looking for a lightweight tool. On our test VPS, BookStack and MariaDB together used around 180 MB of RAM while idle.

BookStack is less suitable if you want to keep personal notes with links in the style of a Zettelkasten. Obsidian is designed for that. BookStack also isn’t intended for collaborating on Office files or for file storage. For those purposes, use Nextcloud.

The Easy Way: BookStack as a One-Click App

The quickest way to get BookStack is through your VPS’s One-Click Apps. The app includes the MariaDB database and is directly accessible over HTTPS with a domain. You don’t need a reverse proxy, certificate, or firewall rules.

Requirements

  • A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set Up One-Click Apps to learn how.
  • For BookStack and MariaDB, plan for at least 1 vCPU core, 512 MB RAM, and 3 GB of storage. We recommend 2 vCPU cores, 1 GB RAM, and 10 GB of storage, especially if you upload a lot of images and attachments.

Install

  1. Open your VPS in the ZapX dashboard and switch to the One-Click Apps tab.
  2. Search the app catalog for BookStack and click Install app.
  3. Use a custom subdomain or zap.cloud is already selected, with a random name. Leave the option enabled or enter your own name, such as wiki or docs.
  4. Under App configuration, enter the email address you want to use to sign in as the admin in BOOKSTACK_ADMIN_EMAIL. If you don’t enter an address, admin@example.com is used. Use a valid address; the app won’t start if the address is invalid. The panel automatically generates the password (SERVICE_PASSWORD_ADMIN), database credentials, and app key. You can fill in the optional email delivery fields (MAIL_HOST, MAIL_USERNAME, and so on) now or add them later. See “Email via SMTP for Invitations.”
  5. Click Queue installation.

After two to three minutes, the app card shows Online. On its first start, BookStack creates the database tables and then replaces BookStack’s default account with your admin account.

First Login

  1. Open the App environment tab using the gear icon on the app card. Under Automatically generated values, you’ll find the password as SERVICE_PASSWORD_ADMIN. Click the eye icon to show it or the icon next to it to copy it.
  2. Open BookStack using the Access link on the app card. You’ll land on the Log In page.
  3. Enter the address from BOOKSTACK_ADMIN_EMAIL under Email and the generated password under Password.

BookStack’s publicly known default login (admin@admin.com with the password password) isn’t used by the One-Click App: the installation replaces it on first startup, before anyone can access the site.

Info: The email address and password only apply on first startup

The admin account is created once using BOOKSTACK_ADMIN_EMAIL and SERVICE_PASSWORD_ADMIN. Changing the email address later in App environment won’t change your account. From then on, manage your email address and password directly in BookStack, as described in the next section.

Set a Custom Password and Enable Two-Factor Authentication

The generated password is long and random, so you can keep using it. If you want to enter your own password or name, you can do so in BookStack:

  1. Click Admin in the top-right corner, then click My Account.
  2. Under Profile Details, enter your name under Name and change Email if needed. Click Save.
  3. In Access & Security, under Change Password, enter your current password under Confirm Current Password, enter a new one under New Password and Confirm New Password, then click Update. App environment will still show the original password, so save your new password in your password manager.
  4. In the same section, use Manage under Multi-Factor Authentication to set up a second factor, such as an authenticator app.

Registration and Address

After installation, no one can create a new account themselves: self-registration is disabled by default. Find the setting under Settings > Registration. Leave Enable registration disabled if you want access to be limited to invited users.

The panel automatically sets your wiki’s address in APP_URL, using https://. All links, images, and stylesheets depend on this value. If you later change the app’s domain under App actions, links and images in existing pages will still point to the old address. In that case, connect to your VPS via SSH and replace the address in the database:

Code
docker exec $(docker ps -q --filter name=bookstack-) php /app/www/artisan bookstack:update-url https://alte-adresse.example.com https://neue-adresse.example.com

If multiple BookStack instances are running on the server, replace the expression in $(...) with the correct container name from docker ps.

Updates and Backups

Update BookStack in the app settings (gear icon) under App update. Click Check for updates and install a new version with Apply update. If it says the app is up to date, there isn’t a newer version in the app catalog yet. BookStack handles any necessary database changes on startup.

Pages, uploads, and settings are stored in the app’s data volumes and are preserved during updates. Back up the entire VPS under Backups in the dashboard. To back up BookStack on its own, use the built-in tool; see “Back Up Your Data” in the manual installation section for details. For the One-Click App, use this command:

Code
docker exec $(docker ps -q --filter name=bookstack-) php /app/www/bookstack-system-cli backup /config/backups/bookstack-backup.zip

The file will then be in the app’s data volume, in the backups folder.

Manual Installation

The rest of this guide describes a manual installation of BookStack with Docker Compose on your VPS. You might choose this, for example, if you don’t use One-Click Apps on your server or want to run BookStack behind your own reverse proxy. We use the same linuxserver.io images as the One-Click App.

Requirements

  • A Linux VPS running Debian or Ubuntu, with SSH access. See First Access via SSH.
  • Docker and Docker Compose (Compose v2). See Install Docker. Check the installation with docker --version and docker compose version.
  • A domain or subdomain whose A record points to your VPS’s IP address (e.g. wiki.example.com).

The values below are for BookStack and MariaDB together. If you’re running more on the server, add the requirements for your other apps.

HardwareMinimumRecommended
CPU1 vCPU core2 vCPU cores
RAM512 MB1 GB
Storage3 GB10 GB

Prepare the Firewall

BookStack listens on port 80 inside the container. In this guide, you’ll access BookStack only through a reverse proxy, while the database remains entirely within the internal Docker network. With ufw, allow only SSH and the ports used by the reverse proxy:

Code
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
Warning: Docker bypasses ufw

Ports published by Docker with ports: are accessible from outside even if ufw blocks them. Docker adds its own rules before those of ufw. So, as described below, bind BookStack only to 127.0.0.1. See Firewall Management on Linux for more information about the firewall.

Install with Docker Compose

Create a directory for BookStack:

Code
mkdir -p /opt/bookstack
cd /opt/bookstack

BookStack needs an app key. Among other things, it encrypts sessions and two-factor authentication data. Generate one using the image itself:

Code
docker run -it --rm --entrypoint /bin/bash lscr.io/linuxserver/bookstack:26.09.3 appkey

The command outputs a line that begins with base64:. Then create the .env file (nano .env) and enter the key and two strong, unique passwords for the database:

Code
APP_URL=https://wiki.example.com
APP_KEY=base64:DEIN_SCHLUESSEL
DB_PASSWORD=LANGES_PASSWORT_1
DB_ROOT_PASSWORD=LANGES_PASSWORT_2

Protect the file with chmod 600 .env. Then create the docker-compose.yml file and add this content:

Code
services:
  bookstack:
    image: lscr.io/linuxserver/bookstack:26.09.3
    container_name: bookstack
    restart: unless-stopped
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - APP_URL=${APP_URL}
      - APP_KEY=${APP_KEY}
      - DB_HOST=mariadb
      - DB_PORT=3306
      - DB_USERNAME=bookstack
      - DB_PASSWORD=${DB_PASSWORD}
      - DB_DATABASE=bookstack
    volumes:
      - ./bookstack:/config
    ports:
      - "127.0.0.1:6875:80"
    depends_on:
      mariadb:
        condition: service_healthy

  mariadb:
    image: lscr.io/linuxserver/mariadb:11.8.9
    container_name: bookstack-db
    restart: unless-stopped
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
      - MYSQL_DATABASE=bookstack
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=${DB_PASSWORD}
    volumes:
      - ./mariadb:/config
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1"]
      interval: 5s
      timeout: 20s
      retries: 10

Here’s what the important lines mean:

  • image: BookStack and MariaDB from linuxserver.io at fixed versions. This lets you decide when to update.
  • APP_URL: The address where your wiki is available, including https:// and without a trailing slash. If it’s incorrect, pages won’t load styles and links won’t work.
  • APP_KEY: The key you just generated. Keep it safe and don’t change it later, or features such as configured two-factor authentication may stop working.
  • DB_* and MYSQL_*: Database credentials. The username and password must match for both services.
  • ./bookstack:/config and ./mariadb:/config: These are where uploads, attachments, configuration, and the database are stored. Back up these folders later.
  • healthcheck and depends_on: BookStack starts only once the database is accepting connections. This prevents table setup from failing on first startup.
  • 127.0.0.1:6875:80: BookStack is accessible only from the server itself, and from outside only through the reverse proxy. The database doesn’t publish a port.

Pull the images and start both containers:

Code
docker compose pull
docker compose up -d
docker compose logs -f bookstack

BookStack is ready when the log shows the line [ls.io-init] done.. Before that, on its first startup, BookStack creates the database tables. Exit the log view with Strg+C.

First Visit

Until the reverse proxy is set up, open BookStack through an SSH tunnel. Run this command on your own PC:

Code
ssh -L 6875:127.0.0.1:6875 root@SERVER_IP

Then open http://localhost:6875 in your browser and sign in with BookStack’s default account: admin@admin.com with the password password. These credentials are listed in the official documentation and are publicly known. So, immediately replace the email address and password as described above in “Set a Custom Password and Enable Two-Factor Authentication,” entering password as your current password. Only then should you make BookStack publicly accessible through the reverse proxy.

Info: Styles may be missing in the tunnel

Since APP_URL already points to your future domain, the page may appear without styles in the tunnel. You can still sign in and change your profile. Once the reverse proxy is running, everything will look normal.

Access via HTTPS Through a Reverse Proxy

To access BookStack from outside, set up a reverse proxy with a valid certificate in front of it. Find the basics in Set Up a Reverse Proxy with nginx and Create an SSL Certificate (Let's Encrypt). Here’s a server block for nginx:

Code
server {
    listen 80;
    server_name wiki.example.com;

    client_max_body_size 50M;

    location / {
        proxy_pass http://127.0.0.1:6875;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
    }
}

Then obtain the certificate with certbot --nginx -d wiki.example.com. Certbot adds HTTPS and HTTP redirection to the block. client_max_body_size sets the maximum size for uploaded images and attachments. The domain must match APP_URL exactly.

Find more tips for securing your server in Linux Security Tips.

Back Up Your Data

BookStack includes its own backup tool, the BookStack System CLI. It packages the database, the .env file, uploads, attachments, and themes into a ZIP file:

Code
docker exec bookstack php /app/www/bookstack-system-cli backup /config/backups/bookstack-backup-$(date +%F).zip

The file will then be on the server at /opt/bookstack/bookstack/backups. It also contains the app key and database credentials, so treat it like a password and don’t store it only on the VPS itself. You can restore the backup to a fresh installation with the restore command from the same tool.

Alternatively, back up the two folders directly. Briefly stop the containers first:

Code
cd /opt/bookstack
docker compose stop
tar czf bookstack-backup-$(date +%F).tar.gz bookstack mariadb .env docker-compose.yml
docker compose start

Update BookStack

Create a backup first, as described above. Then enter the new version for the image in docker-compose.yml and restart:

Code
cd /opt/bookstack
docker compose pull
docker compose up -d
docker image prune

Available versions are listed on the image release page, and changes to BookStack itself are covered on the project blog. The container applies any necessary database changes on startup. Don’t jump blindly between major versions; read the update notes on the blog first. docker image prune then removes the old images.

Build Your Wiki with BookStack

After setup, fill your wiki with content and give others access.

Shelves, Books, Chapters, and Pages

BookStack organizes content into four levels:

LevelPurposeExample
ShelfGroups books by topic“IT,” “Club”
BookA self-contained topic“Server Documentation”
ChapterOptionally organizes a book“Backups”
PageThe actual content“VPS Backup Plan”

Create your first structure like this:

  1. Click Books at the top, then click Create New Book. Enter a name and click Save Book.
  2. In the book, use New Chapter to create chapters and New Page to create pages.
  3. Write the page in the editor and click Save Page. Add images by dragging and dropping them, and add attachments using the paperclip icon in the sidebar.
  4. Under Shelves, click New Shelf to create a shelf and assign books to it.

You can write pages in the WYSIWYG editor or in Markdown. Set the default under Settings > Customization, in Default Page Editor. You can find every saved change later under Revisions, where you can compare or restore it.

Users and Roles

Create additional users under Settings > Users by clicking Add New User. BookStack comes with three roles:

  • Admin: Can do everything, including changing settings and users.
  • Editor: Can create and edit content.
  • Viewer: Can only read.

Customize these roles or create your own under Settings > Roles. Assign more specific permissions directly to shelves, books, chapters, or pages using Permissions. For example, you can make a book visible to only one group.

If you want to show individual content without requiring a login, enable Public Access under Settings > Features & Security. Visitors will then have the permissions of the Public role. Check this role first to make sure only approved books are visible.

Email via SMTP for Invitations

Without email delivery, you have to set a password yourself for each new user. With SMTP, BookStack can send invitations that let people set their own passwords, and “Forgot Password?” will work. You’ll need the SMTP details for an email account.

For the One-Click App, enter the values in the app settings (gear icon) under App environment, then click Save. The app will restart. For a manual installation, add them to the environment section of the bookstack service and restart with docker compose up -d.

VariableMeaningExample
MAIL_HOSTSMTP serversmtp.example.com
MAIL_PORTPort587
MAIL_ENCRYPTIONtls forces an encrypted connection: STARTTLS on port 587, or a direct connection on port 465tls
MAIL_USERNAMEEmail account usernamewiki@example.com
MAIL_PASSWORDEmail account password
MAIL_FROMSender addresswiki@example.com
MAIL_FROM_NAMESender nameBookStack

Then test email delivery under Settings > Maintenance, in the Send a Test Email section, by clicking Send test email. The test email will be sent to the email address in your profile. If it doesn’t arrive, first check the email account’s server, port, and credentials. When creating a user, you can then select Send user invite email.

Limitations

  • No real-time collaborative editing: If two people edit the same page at the same time, BookStack warns you but doesn’t merge the changes.
  • Fixed structure: Pages are always part of a book. There’s no free-form linking like in a Zettelkasten; add cross-references as regular links.
  • Not a file storage system: Attachments are intended for documents related to a page, not as a replacement for file storage.
  • Logins through other services require configuration: BookStack supports single sign-on via OIDC or SAML, but you need to configure it using environment variables, for example with Keycloak or authentik.

Conclusion

BookStack gives you a clear, organized wiki that structures knowledge into shelves, books, chapters, and pages, with detailed permission controls. The One-Click App creates your admin account using your own email address and a generated password. With a manual installation, replace the default login admin@admin.com immediately after your first visit. Then create your structure, invite colleagues, and back up your wiki regularly.

Prefer to skip the Docker setup? Take the easy route with the One-Click App, as described above in “The Easy Way: BookStack as a One-Click App.”

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

The One-Click App is the quickest option: BookStack and MariaDB are ready within minutes and available over HTTPS on your domain. During setup, it creates your admin account using the address in BOOKSTACK_ADMIN_EMAIL and a generated password. You can install updates from App Update in the dashboard. A manual Docker Compose installation is a good choice if you don’t use One-Click Apps on your server or want to run BookStack behind your own reverse proxy. With this option, replace the default login admin@admin.com immediately after your first visit.
For the One-Click App, sign in with the address entered under BOOKSTACK_ADMIN_EMAIL during installation (or admin@example.com if you left it blank). Find the password by clicking the gear icon on the app card, then going to App Environment > Automatically Generated Values and checking SERVICE_PASSWORD_ADMIN. A manual installation starts with BookStack’s publicly known default account, admin@admin.com, and the password password. Change these credentials immediately under Admin > My Account.
Connect to the server via SSH and create a new admin in the BookStack container with php /app/www/artisan bookstack:create-admin. For example: docker exec -it bookstack php /app/www/artisan bookstack:create-admin --email=you@example.com --name=Admin --generate-password. For the One-Click App, replace bookstack with the container name shown by docker ps. Use the new account to reset the old account’s password under Settings > Users.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.