BookStack Installation and Configuration on wiki.deome.net
Overview
This page provides a complete guide to setting up BookStack on wiki.deome.net, including installation, configuration, database setup, and SSL configuration with Let’s Encrypt.
1. Prerequisites
- Web Server: Apache (refer to the Apache wiki page for installation).
- Database: MariaDB (refer to the MariaDB wiki page for installation and configuration).
-
PHP: BookStack requires PHP 7.3 or higher. Install necessary PHP modules.
sudo apt install php php-mysql php-xml php-mbstring php-zip php-gd -y
2. Download and Install BookStack
-
Create the Document Root Directory:
- Create a directory for BookStack:
sudo mkdir -p /var/www/wiki
- Create a directory for BookStack:
-
Download BookStack:
- Navigate to the web root and download the latest version:
cd /var/www/wiki sudo git clone https://github.com/BookStackApp/BookStack.git ./ sudo git checkout release
- Navigate to the web root and download the latest version:
-
Set File Permissions:
- Ensure Apache can read/write to the BookStack files:
sudo chown -R www-data:www-data /var/www/wiki sudo chmod -R 755 /var/www/wiki
- Ensure Apache can read/write to the BookStack files:
3. Configure the Database
-
Log in to MariaDB:
sudo mysql -u root -p -
Create Database and User:
- Create a database for BookStack:
CREATE DATABASE bookstackdb; CREATE USER 'bookstackuser'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON bookstackdb.* TO 'bookstackuser'@'localhost'; FLUSH PRIVILEGES; EXIT;
- Create a database for BookStack:
4. Configure Environment Variables
-
Copy the Environment File:
- BookStack uses an
.envfile for configuration. Copy the example:sudo cp .env.example .env
- BookStack uses an
-
Edit the .env File:
- Open the
.envfile to configure your database and site settings:sudo nano .env - Update the following lines:
# Database configuration DB_HOST=localhost DB_DATABASE=bookstackdb DB_USERNAME=bookstackuser DB_PASSWORD=your_password # Application URL APP_URL=https://wiki.deome.net
- Open the
-
Save and Close: Press
Ctrl + X, thenY, andEnterto save changes.
5. Set Up Apache Virtual Host for wiki.deome.net
-
Create the Virtual Host File:
sudo nano /etc/apache2/sites-available/wiki.deome.net.conf -
Configure the Virtual Host:
- Add the following configuration:
<VirtualHost *:80> ServerName wiki.deome.net DocumentRoot /var/www/wiki/public <Directory /var/www/wiki/public> AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/wiki_error.log CustomLog ${APACHE_LOG_DIR}/wiki_access.log combined </VirtualHost>
- Add the following configuration:
-
Enable the Site and Rewrite Module:
sudo a2ensite wiki.deome.net.conf sudo a2enmod rewrite sudo systemctl reload apache2
6. Set Up SSL with Let’s Encrypt
-
Install Certbot:
- If Certbot is not already installed:
sudo apt install certbot python3-certbot-apache -y
- If Certbot is not already installed:
-
Generate SSL Certificate:
sudo certbot --apache -d wiki.deome.net -
Auto-Renewal Setup:
- Certbot will auto-renew SSL certificates by default. To verify:
sudo certbot renew --dry-run
- Certbot will auto-renew SSL certificates by default. To verify:
7. Complete BookStack Setup
-
Run the BookStack Installation Commands:
- Navigate to the BookStack directory and run the following commands to finish the setup:
cd /var/www/wiki sudo -u www-data php artisan key:generate --force sudo -u www-data php artisan migrate --force
- Navigate to the BookStack directory and run the following commands to finish the setup:
-
Set Permissions (again, if necessary):
- Ensure permissions are still correct after setup:
sudo chown -R www-data:www-data /var/www/wiki sudo chmod -R 755 /var/www/wiki
- Ensure permissions are still correct after setup:
8. Testing and Verification
-
Access BookStack:
- Go to
https://wiki.deome.netin your web browser. - Follow the on-screen instructions to set up the admin account.
- Go to
-
Check Logs:
- Monitor Apache logs if there are any issues:
sudo tail -f /var/log/apache2/wiki_access.log sudo tail -f /var/log/apache2/wiki_error.log
- Monitor Apache logs if there are any issues:
9. Ongoing Maintenance
-
Database Backups:
- Set up a cron job to regularly back up the BookStack database:
mysqldump -u root -p bookstackdb > /path/to/backup/bookstackdb.sql
- Set up a cron job to regularly back up the BookStack database:
-
Updating BookStack:
- Periodically pull the latest updates from the BookStack repository:
cd /var/www/wiki sudo -u www-data git pull origin release sudo -u www-data php artisan migrate --force
- Periodically pull the latest updates from the BookStack repository:
This setup guide for BookStack covers installation, configuration, and basic maintenance. Let me know if you'd like additional details or specific troubleshooting steps included!
No Comments