Installation For Debian 10
Installation For Debian 10
This guide is based from BookStack's official documentation and has been tested this way with
version 0.31.6. Unfortunately, the installation script for Ubuntu provided by BookStack does not
work under Debian 10 due to dependencies, so the path described here goes through the script's
steps manually in an adapted form.
Preparation
To set up BookStack on a freshly installed Debian 10, the required packages must first be installed.
A web server (here: Apache2), a database server (here: MySQL) and PHP are needed:
apt update
Database Setup
Afterwards the security of the MySQL installation should be increased. Therefore, just follow the
dialog of the script:
mysql_secure_installation
Next, we set up a database including a user for BookStack. The user is only needed to connect to
the database, not to login to the web interface:
mysql -u root -p
FLUSH PRIVILEGES;
quit
Installation
Now we download BookStack from the official GitHub page:
cd /var/www
bookstack
Next, we download the composer and run the setup. You might want to delete the composer
afterwards:
cd /var/www/bookstack
rm -f composer-setup.php
export COMPOSER_ALLOW_SUPERUSER=1
BookStack Configuration
After installing successfully, we now connect BookStack to the database that has been set up. For
this, we use the main configuration file, which we need to rename first:
cd /var/www/bookstack
mv .env.example .env
APP_URL=http://HOSTNAME/
DB_HOST=localhost
DB_DATABASE=bookstack
DB_USERNAME=RANDOMUSER
DB_PASSWORD=RANDOMPASSWORD
Now we can generate the app key and populate the database:
Finally, we adjust the permissions accordingly so that the web server has access to the required
subfolders of BookStack:
At this point the setup of BookStack is complete - what is still missing is the configuration of the
web server.
Apache2 Configuration
IMPORTANT: The configuration shown here represents a basic configuration, which should
not be accessible via the internet like this! More information you might want to look into:
https://www.tecmint.com/apache-security-tips/
a2enmod rewrite
<VirtualHost *:80>
ServerName FQDN
ServerAdmin webmaster@localhost
DocumentRoot /var/www/bookstack/public/
<Directory /var/www/bookstack/public/>
AllowOverride None
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
</IfModule>
RewriteEngine On
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^ %1 [L,R=301]
</IfModule>
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
</VirtualHost>
Once the file is created (don't forget to adjust the hostname in line 2), we can enable the
configuration:
a2dissite 000-default.conf
a2ensite bookstack.conf
BookStack is now accessible by browser using the system's hostname/IP. The default login is:
password
In addition to securing Apache2, login via a public network should only be done via HTTPS
(and certificate). Obviously, the default login should also be changed as soon as possible and
the official documentation should be consulted:
https://www.bookstackapp.com/docs/admin/security/
Révision #2
Créé 19 April 2021 14:22:27 par Roland
Mis à jour 19 November 2021 18:08:55 par Roland