Install Gollum Wiki on Ubuntu


Gollum wiki on UbuntuIn this tutorial, we will explain how to install Gollum Wiki on an Ubuntu 16.04 VPS with Puma and Nginx. Gollum is a simple open source wiki system built on top of Git. A Gollum Wiki is a git repository with pages organized into directories any way you choose. This guide should work on other Linux VPS systems as well but was tested and written for Ubuntu 16.04 VPS.

Login to your VPS via SSH

ssh user@vps

Update the system and install necessary packages

[user]# sudo apt-get update && sudo apt-get -y upgrade
[user]# sudo apt-get install git nano curl libicu-dev

Gollum user

Create a new system user for Gollum.

[user]# sudo adduser --home /opt/gollum --shell /bin/bash --gecos 'Gollum Wiki software' gollum
[user]# sudo install -d -m 755 -o gollum -g gollum /opt/gollum
[user]# sudo usermod -a -G sudo gollum
[user]# sudo su - gollum

Install Ruby using RVM

The following commands are run as gollum user.

[gollum]# cd
[gollum]# curl -sSL https://rvm.io/mpapis.asc | gpg --import -
[gollum]# curl -sSL https://get.rvm.io | bash -s stable --ruby

To start using RVM run the following command:

[gollum]# source ~/.rvm/scripts/rvm

The current stable version of Ruby is version 2.3.1

[gollum]# rvm install ruby-2.3.1

To verify everything is done correctly, use the command ruby --version.
The output should be similar to the following:

[gollum]# ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

Install Gollum

We will install Gollum and Puma via RubyGems using the following command:

[gollum]# gem install --no-ri --no-rdoc gollum puma

Create a new, local git repository:

[gollum]# git init ~/gitrepo

Create a systemd service

To create a new systemd service for Gollum, open your editor of choice and create a new file:

[user]$ sudo nano /etc/systemd/system/gollum.service

and add the following lines:

[Unit]
Description=gollum service
After=syslog.target
After=network.target

[Service]
User=gollum
ExecStart=/opt/gollum/.rvm/wrappers/ruby-2.3.1/gollum --live-preview /opt/gollum/gitrepo
Restart=on-abort

[Install]
WantedBy=multi-user.target

Start the Gollum server and set it to start automatically on boot:

[user]$ sudo systemctl enable gollum.service
[user]$ sudo systemctl start gollum.service

To verify the unit started, run systemctl status gollum.service and you should see something like below:

● gollum.service
   Loaded: loaded (/etc/systemd/system/gollum.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2016-09-21 06:00:34 UTC; 7s ago
 Main PID: 10737 (ruby)
   CGroup: /system.slice/gollum.service
           └─10737 puma 3.6.0 (tcp://0.0.0.0:4567) [/]

Install and configure Nginx

To install the latest stable version of Nginx available on the Ubuntu repositories, run:

[user]$ sudo apt-get -y install nginx

Generate a self-signed SSL certificate:

[user]$ sudo mkdir -p /etc/nginx/ssl
[user]$ cd /etc/nginx/ssl
[user]$ sudo openssl genrsa -des3 -passout pass:x -out gollum.pass.key 2048
[user]$ sudo openssl rsa -passin pass:x -in gollum.pass.key -out gollum.key
[user]$ sudo rm gollum.pass.key
[user]$ sudo openssl req -new -key gollum.key -out gollum.csr
[user]$ sudo openssl x509 -req -days 365 -in gollum.csr -signkey gollum.key -out gollum.crt
[user]$ sudo openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

If you don’t want to get warnings associated with self-signed SSL certificates, you can purchase a trusted SSL certificate here.

Next, create a new Nginx server block:

[user]$ sudo nano /etc/nginx/sites-available/myGollumWiki.com
server {
    listen 443 ssl http2;
    server_name myGollumWiki.com;

    location / {
        proxy_pass              http://127.0.0.1:4567;
        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_connect_timeout   150;
        proxy_send_timeout      100;
        proxy_read_timeout      100;
        proxy_buffers           4 32k;
        client_max_body_size    500m;
        client_body_buffer_size 128k;
    }

    ssl on;
    ssl_certificate     /etc/nginx/ssl/gollum.crt;
    ssl_certificate_key /etc/nginx/ssl/gollum.key;
    ssl_dhparam  /etc/nginx/ssl/dhparam.pem;

    ssl_session_timeout 5m;
    ssl_ciphers  EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_protocols TLSv1.2;
    ssl_prefer_server_ciphers on;

    access_log  /var/log/nginx/myGollumWiki.access.log;
    error_log   /var/log/nginx/myGollumWiki.error.log;

}

server {
    listen      80;
    server_name myGollumWiki.com;

    add_header Strict-Transport-Security max-age=2592000;
    rewrite ^ https://$server_name$request_uri? permanent;
}

Activate the server block by creating a symbolic link :

[user]$ sudo ln -s /etc/nginx/sites-available/myGollumWiki.com /etc/nginx/sites-enabled/myGollumWiki.com

Test the Nginx configuration and restart nginx:

[user]$ sudo nginx -t
[user]$ sudo systemctl start nginx

Open http://myGollumWiki.com/ in your favorite web browser and create your first Gollum page.

That’s it. You have successfully installed Gollum on your Ubuntu 16.04 VPS. For more information about how to manage your Gollum installation, please refer to the Gollum wiki.


Of course, you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Tutorials
Install CentOS Web Panel on a CentOS 6 Linux VPS
Tutorials
How to replace MySQL with MariaDB on CentOS 6
Tutorials
Installing Tomcat 8 on a CentOS 7 Linux VPS
There are currently no comments.