How to Install BookStack on Ubuntu Server

BookStack is an open-source platform that allows users to create and organize documentation effectively. If you're planning to install BookStack on an Ubuntu server, here is a step-by-step tutorial to guide you:

Prerequisites

To install BookStack on Ubuntu server, you will need:

Step 1: Update Ubuntu Packages

Before installing BookStack, it's essential to update the Ubuntu package repository for any security patches and bug fixes.

sudo apt update
sudo apt upgrade

Step 2: Install Apache Web Server

Ubuntu server supports Apache web server; install it by typing the following command:

sudo apt install apache2

Step 3: Install PHP

To install PHP for Apache, use the following command:

sudo apt install php libapache2-mod-php php-mysql

Verify that PHP is installed by running this command:

php -v

Step 4: Install MySQL Server

BookStack requires a MySQL server to store data. To install MySQL type the following command:

sudo apt install mysql-server

After installing, run the following command to configure the package:

sudo mysql_secure_installation

Step 5: Create a Database

Create a BookStack database and assign a user with appropriate permissions. Run the following commands in sequence:

sudo mysql -u root -p
CREATE DATABASE bookstack;
CREATE USER 'bookstackuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON bookstack.* TO 'bookstackuser'@'localhost';

Step 6: Install BookStack

Create a new directory '/var/www/bookstack' and set permissions using the commands as follows:

sudo mkdir /var/www/bookstack
sudo chown www-data:www-data /var/www/bookstack

Download the latest version of BookStack:

wget https://github.com/BookStackApp/BookStack/releases/download/v21.06.0/BookStack-21.06.0.tar.gz

Extract the package and move it to the 'bookstack' directory:

tar -xvzf BookStack-*.tar.gz
sudo mv BookStack /var/www/bookstack/

Step 7: Configure BookStack

Copy the sample configuration file and configure the details according to your server environment:

sudo cp /var/www/bookstack/.env.example /var/www/bookstack/.env

Next, edit the '.env' file and change the relevant fields:

APP_URL=http://bookstack.example.com
DB_DATABASE=bookstack
DB_USERNAME=bookstackuser
DB_PASSWORD=password

Step 8: Install BookStack Dependency Package

Navigate to the BookStack directory and install the composer:

cd /var/www/bookstack
sudo curl -sS https://getcomposer.org/installer | php
sudo php composer.phar install --no-dev

Step 9: Configure Apache Web Server

Finally, configure the Apache virtual host connection for BookStack by creating a new configuration file:

sudo nano /etc/apache2/sites-available/bookstack.conf

Add the following content in the configuration file:

<VirtualHost *:80>
    ServerName bookstack.example.com
    ServerAdmin admin@example.com
    DocumentRoot /var/www/bookstack/public/

    <Directory /var/www/bookstack/public/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/bookstack_error.log
    CustomLog ${APACHE_LOG_DIR}/bookstack_access.log combined
</VirtualHost>

Save and close the file.

Disable the default Apache virtual host configuration and enable the 'bookstack.conf':

sudo a2dissite 000-default.conf
sudo a2ensite bookstack.conf

Restart the Apache web server:

sudo systemctl restart apache2

Step 10: Access BookStack

Once the BookStack installation is complete, open your web browser and type the URL of your server IP or domain, such as 'http://bookstack.example.com.' The initial login page will load, and you can sign in with the credentials created during the installation.

That's it! You have successfully installed BookStack on your Ubuntu server, and you can now create and manage documentation efficiently.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!