Skip to main content

Installing Bookstack

This guide covers how to install Bookstack. The following guide is done on a Debian 11 installation, you will also need a user with sudo privileges. See here for the official documentation on requirements.

A working LEMP Stack is required before proceeding with the installation.

Installing Packages

First we will install all the required packages in order to run Bookstack:

sudo apt install php8.1-{common,mbstring,gd,mysql,xml,curl,fpm} git unzip 

Composer is a dependency manager for PHP which is needed for Bookstack. Specific platform installation instructions can also be found on their website. The following section downloads composer and places it in a directory for global use as well as fixing permissions on the file.

curl -O
sudo mv composer.phar /usr/local/bin/composer
sudo chmod 755 /usr/local/bin/composer
Creating The Database And User

With all the packages installed, we can now login to MariaDB as the root user to create our database for Bookstack:

sudo mysql -u root
CREATE DATABASE bookstackdb;
CREATE USER 'bookstackuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON bookstackdb.* TO 'bookstackuser'@'localhost' IDENTIFIED BY 'password';
Setting Up BookStack

Then we can go ahead and clone the release branch of Bookstack and install it's dependencies using composer:

cd /var/www
sudo git clone --branch release --single-branch
cd BookStack
sudo composer install --no-dev

Copy the example environment file and use your favourite editor to fill out the database variables you used above. Adjust the app URL to the domain you are hosting the wiki on. SMTP options can also be entered in if you wish to send out emails.

sudo cp .env.example .env
sudo vim .env

# Database details

Next we generate a unique application key:

# Type yes to set the key
sudo php artisan key:generate

Update the database so it's usable for Bookstack:

# Type yes when it prompts you
sudo php artisan migrate
Configuring BookStack For NGINX

Correct the permissions on the BookStack folder:

sudo chown -R www-data:www-data /var/www/Bookstack/
sudo chmod -R 755 /var/www/Bookstack/

Now we create a server block with NGINX:

sudo vim /etc/nginx/sites-available/bookstack

Insert the following into the file:

Remember to change the domain of server_name and modify the root folder if you setup a different directory to clone BookStack into.

server {
  listen 80;
  listen [::]:80;


  root /var/www/BookStack/public;
  index index.php index.html;

  location / {
    try_files $uri $uri/ /index.php?$query_string;
  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php8.1-fpm.sock;

Then make a symbolic link to enable the server block, check for configuration errors and restart NGINX:

sudo ln -s /etc/nginx/sites-available/bookstack /etc/nginx/sites-enabled/
sudo nginx -t
sudo service nginx reload

From there, verify that it is fully working by going to the domain and checking if you get to the login page.

Default login details
Password: password


At this stage BookStack should be configured and ready for you to start submitting entries. Remember to check the official documentation on maintenance and configuring your instance.