Introduction

BookStack is an open-source platform for organizing and storing documentation, wiki-style. This tutorial will guide you through the process of installing BookStack on Debian 12.

Prerequisites

Before you begin, ensure you have:

  1. A Debian 12 server or desktop system
  2. SSH access to the server (optional)
  3. Root or sudo privileges

Step 1: Install Required Dependencies

Update the package index and install required dependencies:

sudo apt update
sudo apt install -y curl git unzip php php-cli php-fpm php-json php-common php-mbstring php-gd php-xml php-mysql php-zip php-bcmath php-tokenizer php-ctype php-json php-pdo php-xml php-ldap php-mbstring php-curl php-gd php-imagick php-pdo php-mysql php-mbstring php-tokenizer php-xml php-bcmath php-json php-gd php-curl php-zip php-intl mariadb-server nginx

Step 2: Install Composer

Install Composer, a dependency manager for PHP:

sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
sudo php -r "unlink('composer-setup.php');"

Step 3: Configure MariaDB

Secure your MariaDB installation and create a database for BookStack:

sudo mysql_secure_installation
sudo mysql -u root -p
CREATE DATABASE bookstack CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'bookstack'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL ON bookstack.* TO 'bookstack'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 4: Install and Configure BookStack

Clone the BookStack repository from GitHub:

cd /var/www
sudo git clone https://github.com/BookStackApp/BookStack.git
cd BookStack
sudo git checkout release

Install BookStack dependencies and configure environment variables:

sudo composer install --no-dev
sudo cp .env.example .env
sudo php artisan key:generate

Edit the .env file and update the database settings:

sudo nano .env

Update the following settings:

DB_DATABASE=bookstack
DB_USERNAME=bookstack
DB_PASSWORD=your_password

Run the BookStack setup script:

sudo php artisan migrate --force

Set appropriate permissions:

sudo chown -R www-data:www-data /var/www/BookStack

Step 5: Configure Nginx

Create a new Nginx server block for BookStack:

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

Add the following configuration:

server {
    listen 80;
    server_name your_domain.com;

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

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}

Enable the BookStack site and restart Nginx:

sudo ln -s /etc/nginx/sites-available/bookstack /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Step 6: Access BookStack

Open a web browser and navigate to http://your_domain.com to access the BookStack setup wizard. Follow the on-screen instructions to complete the installation.

Conclusion

Congratulations! You have successfully installed BookStack on Debian 12. You can now organize and store documentation using BookStack.

Was this answer helpful? 0 Users Found This Useful (0 Votes)