How to Self-Host BookStack on a VPS (Complete Guide)
BookStack is a simple, self-hosted platform for organizing and storing documentation. If youโre a developer or a homelabber looking to self host BookStack on a VPS, this guide will take you through the installation process step-by-step. We will explore the installation using Docker, which simplifies the deployment and management of applications.
Why Use BookStack?
BookStack enables you to create wiki-style documentation easily, with features such as:
- Nested pages
- Markdown support
- User roles and permissions
- Built-in search capabilities
This makes BookStack an ideal choice for anyone looking to build and maintain documentation for projects or personal use.
Choosing a VPS Provider
There are several VPS providers to choose from based on your budget and requirements. Below is a quick comparison of popular providers:
| Provider | Price (EUR/USD) | Features |
|---|---|---|
| Contabo VPS | 5.99 EUR/mo | SSD storage, high performance |
| Hetzner Cloud | 4.15 EUR/mo | Scalable resources, easy management |
| DigitalOcean | 6 USD/mo | User-friendly interface, extensive documentation |
| Vultr | 6 USD/mo | Global data centers, additional add-on services |
| Linode (Akamai Cloud) | 5 USD/mo | Solid performance, good documentation |
When selecting a VPS provider, consider factors such as pricing, performance, and ease of use. If youโre uncertain, check out our full VPS comparison for more options.
Preparing Your VPS
-
Deploy Your VPS: Choose a provider from the table and set up your VPS. Select your preferred Linux distribution (Ubuntu/Debian is recommended).
-
Access Your Server: Use SSH to connect to your server. You can use a terminal application like PuTTY or your systemโs terminal.
ssh username@your_vps_ip -
Update Your System: Always keep your system up to date.
sudo apt update && sudo apt upgrade -y
Installing Docker
BookStack can be easily run using Docker. Install Docker by running the following commands:
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce -y
You can verify the installation by checking the Docker version:
docker --version
Installing Docker Compose
Docker Compose is a tool for defining and running multi-container Docker applications. Install Docker Compose with the following commands:
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Verify that Docker Compose is installed:
docker-compose --version
Deploying BookStack
-
Create a Directory for BookStack:
mkdir ~/bookstack cd ~/bookstack -
Create a
docker-compose.ymlFile:Use your preferred text editor to create the file:
nano docker-compose.ymlAdd the following configuration:
version: '2' services: bookstack: image: solidnerd/bookstack ports: - "80:80" environment: - DB_HOST=db - DB_USER=bookstack - DB_PASS=bookstackpassword - DB_DATABASE=bookstack depends_on: - db db: image: mysql:5.7 environment: - MYSQL_ROOT_PASSWORD=rootpassword - MYSQL_DATABASE=bookstack - MYSQL_USER=bookstack - MYSQL_PASSWORD=bookstackpassword volumes: - db_data:/var/lib/mysql volumes: db_data:Modify the database passwords as necessary.
-
Start the Containers:
Run the following command to start BookStack:
docker-compose up -dThis command will download the necessary images and start them in detached mode.
-
Access BookStack:
Open your web browser and go to
http://your_vps_ip. You should see the BookStack setup page. Follow the on-screen instructions to finish the installation.
Managing BookStack
You can manage BookStack through the web interface. You can add users, create different books, chapters, and pages according to your needs.
Frequently Asked Questions
Q1: Can I run BookStack without Docker?
Yes, you can install BookStack without Docker, but it requires more manual setup, including configuring PHP, MariaDB, and a web server like Apache or Nginx. Docker simplifies the process significantly, allowing for easier deployment and updates.
Q2: How do I back up my BookStack installation?
To back up your BookStack installation, you will need to back up both the database and the application files. You can achieve this by using Docker commands to copy the database files and save the data from your BookStack directory. Automating this via scripts can further streamline the backup process.
Q3: Is BookStack secure for self-hosting?
BookStack is relatively secure, especially when self-hosted. It is crucial to use strong passwords, keep the software updated, and configure appropriate firewall rules. Additionally, using SSL (via Letโs Encrypt or similar) helps ensure secure access to your BookStack instance over the web.
Conclusion
Self hosting BookStack on a VPS provides a powerful way to manage your documentation needs. With the steps outlined in this guide, you can efficiently deploy and manage your own instance of BookStack. Donโt forget to explore the various features of BookStack and customize it to meet your requirements as you grow your knowledge base. For other options and comparisons of VPS providers, take a look at our full VPS comparison. Happy hosting!