This guide will explain installation of Gollum Wiki on Ubuntu 22.04|20.04|18.04 LTS. Gollum is an open source simple wiki system built on top of Git. Wiki contents are stored in Git repository as text files and can be organized into directories. Gollum work with all recognized file formats including images, PDFs and headers/footers.
Gollum pages may be written in a variety of markup languages and can be edited from the built-in web interface, your text editor or IDE. There is also support for advanced functionalities like macros, UML diagrams, metadata, and more.
Install Gollum Wiki on Ubuntu 22.04|20.04|18.04
This section will discuss the steps of installing Gollum Wiki on Ubuntu 22.04|20.04|18.04. We will start by installing dependencies required, and later build and configure Gollum Wiki on Ubuntu 22.04|20.04|18.04.
Step 1: Install Gollum & Dependencies
We need all dependencies installed. Run below commands to install them.
sudo apt update
sudo apt install -y pkg-config ruby ruby-dev make zlib1g-dev libicu-dev build-essential git asciidoc cmake
Gollum in written in Ruby and a number of Ruby gems are required. Let’s ensure the basic are installed.
sudo gem install gollum \
org-ruby \
omnigollum \
github-markup \
omniauth-github
All Gollum markups are rendered by the github-markup gem, but you can easily add support for other markups by additional installation. Example:
MediaWiki:
sudo gem install wikicloth
Textile:
sudo gem install RedCloth
GitHub Flavored Markdown:
sudo gem install github-markdown
Step 2: Setting up Gollum Git repository
After the initial installation, Gollum requires a git repository to be pointed at to work. Let’s first add a dedicated user to access that repository.
$ sudo adduser --shell /bin/bash --gecos 'Gollum application' gollum
Adding user
gollum' ... Adding new group
gollum' (1001) …
Adding new user
gollum' (1001) with group
gollum' …
Creating home directory
/home/gollum' ... Copying files from
/etc/skel' …
Enter new UNIX password: <Enter Password>
Retype new UNIX password: <Retype Password>
passwd: password updated successfully
# Add user to sudo group
$ sudo usermod -aG sudo gollum
Switch to gollum user and configure Git username and email address.
sudo su - gollum
git config --global user.name "Admin Doe"
git config --global user.email "[email protected]"
You can edit Git configuration file to update:
$ vim ~/.gitconfig
[user]
name = John Doe
email = [email protected]
Create wiki directory and initialize it.
$ mkdir wiki && cd wiki
$ git init .
Initialized empty Git repository in /home/gollum/wiki/.git/
Step 3: Configure Gollum Systemd service
We’ll be setting up Gollum to start as a systemd service when the server starts. This will allow us to control its start/stop/restart
when we need to shut it down (e.g. on upgrades).
Create Gollum configurations directory
sudo mkdir /etc/gollum/
Add configuration template.
cat<<EOF | sudo tee /etc/gollum/config.rb
=begin
This file can be used to (e.g.):
- alter certain inner parts of Gollum,
- extend it with your stuff.
It is especially useful for customizing supported formats/markups. For more information and examples:
- https://github.com/gollum/gollum#config-file
=end
# enter your Ruby code here ...
EOF
Create a new Gollum systemd unit file.
cat<<EOF | sudo tee /etc/systemd/system/gollum.service
[Unit]
Description=Gollum wiki server
After=network.target
After=syslog.target
[Service]
Type=simple
User=gollum
Group=gollum
WorkingDirectory=/home/gollum/wiki/
ExecStart=/usr/local/bin/gollum --config "/etc/gollum/config.rb"
Restart=on-abort
[Install]
WantedBy=multi-user.target
EOF
Reload systemd configuration
sudo systemctl daemon-reload
Start and enable the service to start at boot.
sudo systemctl restart gollum.service
sudo systemctl enable gollum.service
Check service status, it should show running
.
$ systemctl status gollum
● gollum.service - Gollum wiki server
Loaded: loaded (/etc/systemd/system/gollum.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-04-02 13:09:38 UTC; 15s ago
Main PID: 17592 (gollum)
Tasks: 1 (limit: 4677)
Memory: 78.4M
CGroup: /system.slice/gollum.service
└─17592 /usr/bin/ruby2.7 /usr/local/bin/gollum --config /etc/gollum/config.rb
Apr 02 13:09:46 ubuntu-20-04-02 gollum[17592]: [2022-04-02 13:09:46] INFO WEBrick 1.7.0
Apr 02 13:09:46 ubuntu-20-04-02 gollum[17592]: [2022-04-02 13:09:46] INFO ruby 2.7.0 (2019-12-25) [x86_64-linux-gnu]
Apr 02 13:09:46 ubuntu-20-04-02 gollum[17592]: == Sinatra (v2.2.0) has taken the stage on 4567 for production with backup from WEBrick
Apr 02 13:09:46 ubuntu-20-04-02 gollum[17592]: [2022-04-02 13:09:46] INFO WEBrick::HTTPServer#start: pid=17592 port=4567
Gollum runs on TCP port
$ ss -tunelp | grep 4567
tcp LISTEN 0 128 0.0.0.0:4567 0.0.0.0:* users:(("gollum",pid=4527,fd=7)) uid:1001 ino:63478 sk:5 <->
Web dashboard can be accessed on Server IP address and port 4567.
Step 4: Configure Nginx proxy
The default setting is to expose Gollum web console on server IP address. If you want to access it via domain name, you’ll need to configure Nginx.
Disable apache2 service if running:
sudo systemctl disable --now apache2
Install nginx web server on Ubuntu
sudo apt -y install nginx
Once installed, add nginx configuration.
sudo vim /etc/nginx/conf.d/gollum.conf
Modify below data and add it to the file.
server {
listen 80;
server_name wiki.example.com www.wiki.example.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;
}
access_log /var/log/nginx/gollum-access.log;
error_log /var/log/nginx/gollum-error.log;
}
Replace wiki.example.com
with your domain name and validate Nginx configurations.
$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Restart nginx to load new configuration file.
sudo systemctl restart nginx
For SSL configuration. refer to configuration file below.
server {
listen 443 ssl http2;
server_name wiki.example.com www.wiki.example.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/letsencrypt/live/wiki.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/wiki.example.com//privkey.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/gollum-access.log;
error_log /var/log/nginx/gollum-error.log;
}
server {
listen 80;
server_name wiki.example.com;
add_header Strict-Transport-Security max-age=2592000;
rewrite ^ https://$server_name$request_uri? permanent;
}
Where:
- wiki.example.com is your domain name for Wiki
- /etc/letsencrypt/live/wiki.example.com/fullchain.pem is a path to your SSL certificate.
- /etc/letsencrypt/live/wiki.example.com/privkey.pem is the path to SSL private key.
- The above configurationn will redirect all http traffic to https.
Our next guide will cover how to configure Authentication for Gollum Wiki pages.
Other Wiki installation guides:
- Install Wiki.js on Ubuntu 18.04 / CentOS 7
- Install DokuWiki on Ubuntu 18.04 with Nginx and Let’s Encrypt
- Install Dokuwiki with Nginx and Letsencrypt SSL on CentOS 7