How to Install BookStack on CentOS 7

  1. Easy and Simple Interface
  2. Searchable and Connected
  3. Configurable
  4. Multilingual
  5. Integrated Authentication
  6. Optional Markdown Editor

Prerequisites

  1. You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you are a new user, you can get a free account in your Alibaba Cloud account. If you don’t know about how to set up your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 1GB RAM and 1 Core processor.
  2. Root user privileges

Update the System

In this whole article, we are installing BookStack as a root user. You can also switch to root user using sudo -icommand. It is recommended to install any package on a freshly updated server, so first, update all the available packages.
yum -y update

Install Nginx

Nginx is a web server which is required to install BookStack, so first, you’ll have to install nginx on your CentOS 7 system.
yum -y install nginx

Install PHP and PHP-FPM

Now nginx web server is installed on your system. Next, you’ll have to install PHP and PHP-FPM with some required extensions to install BookStack.

listen.owner = nginx  
listen.group = nginx
listen.mode = 0660
env[HOSTNAME] = $HOSTNAME  
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

Install and Configure MariaDB

We will need to install MariaDB for database purposes for BookStack. Run this command to install MariaDB.
yum -y install mariadb-server

[root@Sajid ~]# systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2018-07-20 06:24:13 UTC; 1min 45s ago
Main PID: 23790 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─23790 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─23952 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/ma...
Jul 20 06:24:11 ip-172-31-21-196.us-west-2.compute.internal mariadb-prepare-db-dir[23712]: MySQL manual for more instructions.
Jul 20 06:24:11 ip-172-31-21-196.us-west-2.compute.internal mariadb-prepare-db-dir[23712]: Please report any problems at http://mariadb....ira
Jul 20 06:24:11 ip-172-31-21-196.us-west-2.compute.internal mariadb-prepare-db-dir[23712]: The latest information about MariaDB is avail...g/.
Jul 20 06:24:11 ip-172-31-21-196.us-west-2.compute.internal mariadb-prepare-db-dir[23712]: You can find additional information about the...at:
Jul 20 06:24:11 ip-172-31-21-196.us-west-2.compute.internal mariadb-prepare-db-dir[23712]: http://dev.mysql.com
Jul 20 06:24:11 ip-172-31-21-196.us-west-2.compute.internal mariadb-prepare-db-dir[23712]: Consider joining MariaDB's strong and vibrant...ty:
Jul 20 06:24:11 ip-172-31-21-196.us-west-2.compute.internal mariadb-prepare-db-dir[23712]: https://mariadb.org/get-involved/
Jul 20 06:24:11 ip-172-31-21-196.us-west-2.compute.internal mysqld_safe[23790]: 180720 06:24:11 mysqld_safe Logging to '/var/log/mariad...og'.
Jul 20 06:24:11 ip-172-31-21-196.us-west-2.compute.internal mysqld_safe[23790]: 180720 06:24:11 mysqld_safe Starting mysqld daemon with...ysql
Jul 20 06:24:13 ip-172-31-21-196.us-west-2.compute.internal systemd[1]: Started MariaDB database server.
Hint: Some lines were ellipsized, use -l to show in full.
Set root password? [Y/n] Y  
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Install PHP Composer

The composer is a dependency for PHP and you’ll have to install it first before installing BookStack. Simply run below command and it will do the job for you.
curl -sS https://getcomposer.org/installer | php

Install BookStack

All the dependencies are installed now and we are ready to install BookStack from git.

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: barryvdh/laravel-debugbar
Discovered Package: barryvdh/laravel-dompdf
Discovered Package: barryvdh/laravel-ide-helper
Discovered Package: barryvdh/laravel-snappy
Discovered Package: fideloper/proxy
Discovered Package: intervention/image
Discovered Package: laravel/socialite
Discovered Package: socialiteproviders/manager
Package manifest generated successfully.
> php artisan cache:clear
Cache cleared successfully.
> php artisan view:clear
Compiled views cleared!
# Database details  
DB_HOST=localhost
DB_DATABASE=bookstack_data
DB_USERNAME=bookstack_user
DB_PASSWORD=Strong Password

Creating a Virtual Host

Finally, you’ll need to create a virtual host to access BookStack application through web interface. Before creating virtual host first, edit the ‘/etc/nginx/nginx.conf’ file to make virtual host configuration as default configuration.
nano /etc/nginx/nginx.conf

server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
server {
listen 80 default_server;
server_name _ ;
root /var/www/BookStack/public;

access_log /var/log/nginx/bookstack_access.log;
error_log /var/log/nginx/bookstack_error.log;

client_max_body_size 1G;
fastcgi_buffers 64 4K;

index index.php;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README) {
deny all;
}

location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
}

location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
access_log off;
}
}

Web Interface

BookStack is now installed on your CentOS 7 server completely. Open up your favorite web browser and visit the http://YourServerIP/ or http://YourServerDoaminName/ for your BookStack.

Conclusion

In this article, you’ve learned how to install BookStack Documentation Wiki on your CentOS 7 server. you also learned to configure Nginx web server and BookStack. We hope now you have enough knowledge to work with BookStack.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com