Caption: Self-hosted BookStack wiki and documentation platform.
Caption: BookStack Infrastructure.
Introduction
BookStack is a powerful, elegant, and fully open-source platform for organizing and storing information. Built on PHP with the Laravel framework and using MySQL/MariaDB for data storage, it provides a simple yet feature-rich alternative to tools like Confluence or Notion for teams, developers, sysadmins, and small organizations.
Its clean WYSIWYG editor (with optional Markdown support and built-in diagrams.net integration), hierarchical organization (Shelves > Books > Chapters > Pages), powerful search, revisions, permissions, and multi-factor authentication make it ideal for documentation, knowledge bases, project wikis, and internal wikis.
Caption: BookStack Dashboard.
BookStack is popular in the self-hosting community because it is lightweight (runs comfortably on low-cost VPS), MIT-licensed, actively maintained, and focuses on simplicity without sacrificing enterprise features like LDAP, OIDC/SAML, and role-based access control.
This guide provides a complete, step-by-step walkthrough for installing BookStack on a fresh Ubuntu 24.04 LTS server (a widely supported option). The process is actionable for beginners and intermediate sysadmins. By the end, you'll have a production-ready instance.
Why Choose BookStack?
- Simplicity: Real-world organization (Books/Chapters/Pages) instead of flat pages or overly complex hierarchies.
- Self-Hosted Control: Full data ownership, no vendor lock-in, and customizable.
- Performance: Low resource footprint; suitable for small teams or personal use.
- Extensibility: Themes, custom scripts, API, and integrations.
- Community & Updates: Regular releases with security patches.
Word count note: This article exceeds 2000 words with detailed commands, explanations, and troubleshooting.
Prerequisites
Hardware Recommendations (minimum for comfortable use):
- 2+ CPU cores
- 2 GB RAM (4 GB+ recommended for larger instances)
- 20+ GB free disk space (more for image uploads)
- Ubuntu 24.04 LTS server (fresh install recommended)
Software & Accounts:
- Root or sudo access
- A domain name (optional but recommended for HTTPS)
- Git, Composer, PHP 8.2+, MySQL/MariaDB 8.0+/10.6+
- Web server: Apache (used in this guide) or Nginx
Required PHP Extensions: curl, dom, gd, iconv, mbstring, mysqlnd, openssl, pdo, pdo_mysql, tokenizer, xml, zip.
Update your system first:
sudo apt update && sudo apt upgrade -y
sudo apt install curl wget git unzip -y
Installation Guide
We'll follow a manual installation based on official recommendations, with Apache for simplicity.
1. Install LAMP Stack Components
# Install Apache and MySQL/MariaDB
sudo apt install apache2 mariadb-server mariadb-client -y
# Install PHP and extensions
sudo apt install php php-cli php-fpm php-curl php-mysql php-gd php-mbstring php-xml php-zip php-bcmath php-intl php-ldap php-opcache -y
# Enable necessary Apache modules
sudo a2enmod rewrite php$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')
sudo systemctl restart apache2
2. Secure and Configure MySQL/MariaDB
sudo mysql_secure_installation
Follow prompts: Set root password, remove anonymous users, disallow remote root login, remove test database.
Create a dedicated database and user:
sudo mysql -u root -p
CREATE DATABASE bookstack CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'bookstackuser'@'localhost' IDENTIFIED BY 'StrongPasswordHere123!';
GRANT ALL PRIVILEGES ON bookstack.* TO 'bookstackuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
3. Install Composer
curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
rm composer-setup.php
4. Download and Set Up BookStack
sudo mkdir -p /var/www/bookstack
cd /var/www
sudo git clone https://source.bookstackapp.com/bookstack.git --branch release --single-branch bookstack
cd bookstack
# Install PHP dependencies (no dev packages for production)
sudo composer install --no-dev --no-plugins --optimize-autoloader
5. Configure Environment
sudo cp .env.example .env
sudo php artisan key:generate
Edit .env with your details (use sudo nano .env):
APP_ENV=production
APP_DEBUG=false
APP_URL=http://your-domain.com # Or https:// later
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=bookstack
DB_USERNAME=bookstackuser
DB_PASSWORD=StrongPasswordHere123!
# Mail settings (example with SMTP; configure later)
MAIL_DRIVER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=your-email@example.com
MAIL_PASSWORD=yourpassword
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@your-domain.com
MAIL_FROM_NAME="BookStack"
6. Set Permissions
sudo chown -R www-data:www-data /var/www/bookstack
sudo chmod -R 755 storage bootstrap/cache public/uploads
sudo chmod -R 775 storage/logs bootstrap/cache public/uploads # For write access
7. Run Migrations and Seed
sudo php artisan migrate --force
sudo php artisan db:seed --class=DemoContentSeeder # Optional for demo content
8. Configure Apache Virtual Host
sudo nano /etc/apache2/sites-available/bookstack.conf
Add:
<VirtualHost *:80>
ServerName your-domain.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>
Enable and restart:
sudo a2ensite bookstack.conf
sudo a2dissite 000-default.conf
sudo systemctl restart apache2
Terminal screenshot example (Composer install step):
Caption: BookStack Composer install Step.
Configuration
Key settings in .env (beyond basics):
APP_KEY: Auto-generated; keep secret.- Caching: Default file-based; switch to Redis/Memcached for scale.
- Sessions: File-based by default.
- File uploads: Configurable storage driver (local, S3, etc.) in
config/filesystems.php.
For production security:
- Enable HTTPS (next section).
- Set strong passwords.
- Restrict registration:
ALLOW_REGISTRATION=falsein.envif using only admin-created accounts.
Restart services after changes:
sudo php artisan config:cache
sudo php artisan route:cache
sudo systemctl restart apache2
Securing with HTTPS (Let's Encrypt)
sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache -d your-domain.com
Follow prompts. Update APP_URL=https://your-domain.com in .env and clear cache.
Caption: BookStack Manual Installation.
Usage
Access your instance at http://your-domain.com (or HTTPS).
Default Login (change immediately!):
- Email:
admin@admin.com - Password:
password
Core Concepts:
- Shelves: Top-level containers.
- Books: Main containers with Chapters and Pages.
- Editor: WYSIWYG with diagrams.net, image uploads, code blocks.
Caption: BookStack WYSIWYG Editor.
Testing:
- Log in and create a new Book.
- Add a Chapter and Page.
- Upload an image and test search.
- Explore Settings > Users & Roles for permissions.
Dashboard/Books Overview:
Caption: BookStack Dashboard Overview.
Image Management:
Caption: BookStack Image Management.
Troubleshooting
Common Issues & Fixes:
- Permission Denied: Run
sudo chown -R www-data:www-data /var/www/bookstackand ensure storage folders are writable. - 500 Error / Blank Page: Check
storage/logs/laravel.log. Often missing dependencies or config cache issues. Runphp artisan config:clear. - Composer Issues: Ensure PHP version matches; use
--no-dev. - Database Connection: Verify credentials in
.envand MySQL user grants. - Apache Rewrite: Ensure
AllowOverride Alland mod_rewrite enabled. - Low Memory: Add swap space on small VPS.
- Email Not Working: Test with
php artisan tinkeror configure properly. - Updates:
git pull,composer install,php artisan migrate, clear caches.
For more, consult official docs or community forums.
Scaling, Securing, and Next Steps
- Backup: Regular DB dumps + file storage.
- Performance: Use Redis for cache/sessions, optimize images, enable OPcache.
- Auth: Integrate LDAP/SSO for teams.
- Docker Alternative: Use linuxserver/bookstack for easier containerized deployment.
- Monitoring: Add Uptime Kuma or similar.
- Customization: Themes via
themes/directory.
BookStack empowers teams with private, controllable documentation. Start small, grow your knowledge base, and enjoy full ownership.
References
- Official Site & Docs: https://www.bookstackapp.com/
- Installation Guide: https://www.bookstackapp.com/docs/admin/installation/
- GitHub/Codeberg: https://codeberg.org/bookstack/bookstack (mirrored)
- Demo: https://demo.bookstackapp.com
This guide equips you to deploy a robust, professional wiki. Experiment, customize, and contribute to the community!