Installing BookStack on a VPS: A Personal Wiki and Team Knowledge Base
TL;DR
In this detailed guide, we will step-by-step configure BookStack — a powerful and intuitive open-source knowledge management system — on your own Virtual Private Server (VPS) running Ubuntu 24.04 LTS. You will get a fully functional platform for creating and storing documentation, accessible to your team or for personal use, with automatic HTTPS, a backup mechanism, and basic security.
- Configuring BookStack version 24.04+ on Ubuntu 24.04 LTS.
- Using a PHP 8.3/8.4, MySQL 8.0 stack, and Caddy web server for automatic TLS.
- Ensuring basic server security with UFW and Fail2ban.
- Setting up automatic data and database backups.
- Detailed commands and configuration files are ready for copying and execution.
What We Are Configuring and Why
We will be installing BookStack — a free and open platform for creating and organizing documentation, ideal for personal notes, team wikis, knowledge bases, product manuals, and much more. It is designed with an emphasis on ease of use and a clean, modern interface. BookStack allows you to structure information into "books", "chapters", and "pages", supports Markdown and WYSIWYG editors, and features a powerful search and access control system.
Ultimately, you will get a completely independent, private, and self-controlled knowledge base, accessible via your domain name. This is especially valuable for startups, development teams, solo SaaS project founders, or anyone who values privacy and full control over their data.
There are various alternatives, such as cloud solutions (Confluence, Notion, GitLab Wiki, Google Docs) or other self-hosted platforms (Wiki.js, MediaWiki). Cloud services are convenient but often come with a monthly fee, storage limitations, and most importantly, you don't fully own your data, entrusting it to a third-party provider. Self-hosted solutions on a VPS, on the other hand, give you full sovereignty over your information, allow you to precisely configure the server to your needs, and, with the right approach, can be significantly more economical in the long run, especially if you already rent a VPS for other tasks. You can also be confident in the absence of hidden "features" and surveillance, which is critical for projects requiring a high degree of confidentiality.
What VPS Configuration is Needed for This Task
BookStack itself is not very resource-intensive, but for the stable operation of the entire stack (operating system, database, PHP-FPM, web server), certain minimum characteristics are required. These requirements are relevant for 2026, considering modern software versions.
Minimum Requirements for a Small Project (up to 5-10 active users, up to 1000 pages):
- CPU: 1-2 vCPU. For basic operation, one core is sufficient, but 2 cores will provide better responsiveness with several users working simultaneously or during background tasks.
- RAM: 2 GB. This will be enough for Ubuntu Server 24.04 LTS, PHP 8.3/8.4, MySQL 8.0, and Caddy. If you plan to run other services on the same VPS, consider 4 GB.
- Disk: 40 GB SSD. The system will take about 10-15 GB. The rest will go to the BookStack database, image files, attachments, and logs. SSD is critically important for database performance and overall system responsiveness.
- Network: 100 Mbps port, 500 GB - 1 TB traffic per month. For a typical wiki, this is more than enough.
Recommended VPS Plan for a Team (up to 20-30 active users, thousands of pages, regular file uploads):
- CPU: 2 vCPU.
- RAM: 4 GB.
- Disk: 80 GB SSD.
- Network: 1 Gbps port, 2-3 TB traffic per month.
For these characteristics, you can consider a VPS with the specified characteristics.
When a Dedicated Server is Needed, Not a VPS
A dedicated server becomes justified if:
- Very High Load: Hundreds of simultaneously active users, thousands of requests per second.
- Large Data Volume: Tens of thousands of pages, terabytes of attachments and files.
- Performance Requirements: Maximum and predictable performance is needed without "sharing" with other provider clients.
- Specific Hardware: The need for special RAID arrays, GPUs, or other hardware solutions not available on a VPS.
- Running Many Other Services: If, in addition to BookStack, other resource-intensive applications (CI/CD, heavy databases, game servers) will run on the server.
In most cases, a well-configured VPS is sufficient for BookStack. If you choose a dedicated server, make sure its characteristics meet your needs, for example, a suitable dedicated server.
Location: What it Affects
The choice of VPS location affects several key factors:
- Latency: The closer the server is to your main audience or team, the faster the website's response will be. For a team in Europe, choose European data centers.
- Legislation: Data storage laws can vary significantly between countries. Ensure that the chosen location complies with your privacy requirements and legal norms.
- Service Availability: Some cloud storage or CDNs may have better integration or performance in certain regions.
- Cost: VPS prices can vary depending on the location.
Server Preparation
Before installing BookStack, you need to perform basic setup of a fresh server. We will be using Ubuntu Server 24.04 LTS.
1. Connecting to the Server
Connect to your VPS via SSH. If your provider grants root access, it is recommended to immediately create a new user with sudo privileges.
ssh root@YOUR_VPS_IP_ADDRESS
2. Creating a New User and Configuring Sudo (if necessary)
If you logged in as root, create a new user, for example, bookstackuser:
adduser bookstackuser
usermod -aG sudo bookstackuser
Then log out and log in as the new user:
exit
ssh bookstackuser@YOUR_VPS_IP_ADDRESS
3. Updating the System
Always start by updating the package list and installed packages to the latest versions. This ensures you have the latest security fixes and up-to-date versions of system libraries.
sudo apt update && sudo apt upgrade -y
4. Configuring the Firewall (UFW)
Enable the UFW firewall and allow only the necessary ports. This is critically important for security.
sudo apt install ufw -y # Install UFW if not already installed
sudo ufw allow OpenSSH # Allow SSH (port 22)
sudo ufw allow http # Allow HTTP (port 80)
sudo ufw allow https # Allow HTTPS (port 443)
sudo ufw enable # Enable UFW
sudo ufw status # Check firewall status
When prompted to confirm enabling UFW, enter y.
5. Installing Fail2ban
Fail2ban helps protect the server from brute-force attacks by blocking IP addresses that make too many failed login attempts.
sudo apt install fail2ban -y
sudo systemctl enable fail2ban # Enable Fail2ban autostart
sudo systemctl start fail2ban # Start Fail2ban
For basic configuration, you can create the file /etc/fail2ban/jail.local:
sudo nano /etc/fail2ban/jail.local
Insert the following content:
[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
bantime = 1h
Save the file (Ctrl+O, Enter) and exit (Ctrl+X). Then restart Fail2ban:
sudo systemctl restart fail2ban
6. Installing Basic Utilities
Let's install the necessary utilities that will be needed during the BookStack installation process.
sudo apt install git curl wget unzip -y
Software Installation — Step-by-step
Now that the server is prepared, let's proceed with installing all necessary components for BookStack: PHP, Composer, MySQL, and Caddy.
1. Installing PHP and Required Extensions
BookStack version 24.04+ requires PHP 8.1 or higher. We will install PHP 8.3/8.4, which will be current in 2026 and provide good performance. To do this, we first add the ondrej/php repository, which contains fresh PHP versions.
sudo apt install software-properties-common -y # Install utility for working with PPA
sudo add-apt-repository ppa:ondrej/php -y # Add PHP repository
sudo apt update # Update package list after adding repository
sudo apt install php8.3-fpm php8.3-mysql php8.3-gd php8.3-mbstring php8.3-xml php8.3-bcmath php8.3-zip php8.3-curl php8.3-common php8.3-cli -y # Install PHP 8.3 FPM and required extensions
sudo systemctl enable php8.3-fpm # Enable PHP-FPM autostart
sudo systemctl start php8.3-fpm # Start PHP-FPM
Note: If PHP 8.4 becomes current by 2026, simply replace php8.3 with php8.4 in all commands.
2. Installing Composer
Composer is a dependency manager for PHP, necessary for installing BookStack components.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" # Download Composer installation script
php composer-setup.php --install-dir=/usr/local/bin --filename=composer # Install Composer globally
php -r "unlink('composer-setup.php');" # Delete installation script
composer --version # Check Composer version
3. Installing MySQL Server
BookStack uses a database to store all information. We will install MySQL 8.0.
sudo apt install mysql-server -y # Install MySQL Server 8.0
sudo systemctl enable mysql # Enable MySQL autostart
sudo systemctl start mysql # Start MySQL
sudo mysql_secure_installation # Run script for secure MySQL setup
During mysql_secure_installation, follow the instructions:
- Install the
VALIDATE PASSWORD COMPONENTplugin (recommended). - Set a strong password for the MySQL
rootuser. - Answer
Yto all other questions (remove anonymous users, disallow remote root login, remove test database, reload privilege tables).
Let's create a database and user for BookStack. Replace bookstack_db, bookstack_user, and ВАШ_НАДЕЖНЫЙ_ПАРОЛЬ_ДЛЯ_БД with your own values.
sudo mysql -u root -p # Log in to MySQL as root (the previously entered password will be required)
Inside the MySQL console, execute:
CREATE DATABASE bookstack_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'bookstack_user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR_STRONG_DATABASE_PASSWORD';
GRANT ALL PRIVILEGES ON bookstack_db. TO 'bookstack_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
4. Installing BookStack
Let's clone the BookStack repository into the /var/www/bookstack directory.
sudo mkdir -p /var/www/bookstack # Create directory for BookStack
sudo chown bookstackuser:bookstackuser /var/www/bookstack # Change directory owner
cd /var/www/bookstack # Change to directory
git clone https://github.com/BookStackApp/BookStack.git . # Clone repository into current directory
Let's install BookStack dependencies using Composer.
composer install --no-dev # Install dependencies without dev packages
Let's configure access permissions for BookStack directories.
sudo chown -R www-data:www-data /var/www/bookstack # Change file owner to web server user
sudo chmod -R 755 /var/www/bookstack # Set read/write permissions for files
sudo chmod -R 775 /var/www/bookstack/storage /var/www/bookstack/bootstrap/cache # Set write permissions for critical directories
5. Installing Caddy Web Server
Caddy is a powerful web server that automatically manages HTTPS certificates (Let's Encrypt), which greatly simplifies setup. It's an excellent alternative to Nginx and Apache.
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https # Install necessary packages
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg # Add GPG key
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list # Add Caddy repository
sudo apt update # Update package list
sudo apt install caddy -y # Install Caddy
sudo systemctl enable caddy # Enable Caddy autostart
sudo systemctl start caddy # Start Caddy
Caddy is now installed and ready. In the next step, we will configure it.