Install Asciidoctor on Linux

When you install Asciidoctor using your Linux distribution’s package manager, the manager will also install Ruby and RubyGems if they’re not already on your machine.

DNF

On RPM-based Linux distributions, such as Fedora, CentOS, and RHEL, use the DNF package manager to install Asciidoctor. To install the package, open a terminal and type:

$ sudo dnf install -y asciidoctor

If the gem installed successfully, its command line interface (CLI) will be available on your PATH. To confirm that Asciidoctor is available, execute:

$ asciidoctor --version

You should see information about the Asciidoctor version and your Ruby environment printed in the terminal.

Asciidoctor 1.5.8 [https://asciidoctor.org]
Runtime Environment (ruby 2.4.1p111 [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:- ex:UTF-8)

APT

On Debian and Debian-based distributions such as Ubuntu, use the Advanced Packaging Tool (APT) to install Asciidoctor. To install the package, open a terminal and type:

$ sudo apt-get install -y asciidoctor

If the gem installed successfully, its command line interface (CLI) will be available on your PATH. To confirm that Asciidoctor is available, execute:

$ asciidoctor --version

You should see information about the Asciidoctor version and your Ruby environment printed in the terminal.

Asciidoctor 1.5.8 [https://asciidoctor.org]
Runtime Environment (ruby 2.4.1p111 [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:- ex:UTF-8)

Alpine Linux

Alpine Linux uses the apk took to install and manage packages. To install the Asciidoctor package, open a terminal and type:

$ sudo apk add asciidoctor

If the gem installed successfully, its command line interface (CLI) will be available on your PATH. To confirm that Asciidoctor is available, execute:

$ asciidoctor --version

You should see information about the Asciidoctor version and your Ruby environment printed in the terminal.

Asciidoctor 1.5.8 [https://asciidoctor.org]
Runtime Environment (ruby 2.4.1p111 [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:- ex:UTF-8)

Package manager versus gem command

The benefit of installing Asciidoctor using a Linux package manager is that it will install and manage the corresponding Ruby and RubyGems versions if they’re not already on your machine. However, some Linux distributions don’t have the latest version of Asciidoctor packaged immediately after a new Asciidoctor gem is released. If you need the latest version of Asciidoctor immediately, you’ll have to use the gem command. You’ll also use the gem command to use a pre-release version of Asciidoctor.

gem install

If you plan to install Asciidoctor using the gem command, you should use RVM to install Ruby in your home directory (i.e., user space) first. Then, you can safely use the gem command to install or update the Asciidoctor gem. When using RVM, gems are installed in a location isolated from the system.

To install Asciidoctor using the gem command, open a terminal and type:

$ gem install asciidoctor

If the gem installed successfully, its command line interface (CLI) will be available on your PATH. To confirm that Asciidoctor is available, execute:

$ asciidoctor --version

You should see information about the Asciidoctor version and your Ruby environment printed in the terminal.

Asciidoctor 1.5.8 [https://asciidoctor.org]
Runtime Environment (ruby 2.4.1p111 [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:- ex:UTF-8)

Install a pre-release version

To install a pre-release version of Asciidoctor, open a terminal and type:

$ gem install asciidoctor --pre

Install using Bundler

To install Asciidoctor for a project using Bundler:

  1. Open your project’s Gemfile

  2. Add the asciidoctor gem using:

    gem 'asciidoctor'
  3. Save the Gemfile

  4. Open a terminal

  5. Install the gem using the bundle command:

    $ bundle

If the gem installed successfully, its command line interface (CLI) will be available on your PATH. To confirm that Asciidoctor is available, execute:

$ asciidoctor --version

You should see information about the Asciidoctor version and your Ruby environment printed in the terminal.

Asciidoctor 1.5.8 [https://asciidoctor.org]
Runtime Environment (ruby 2.4.1p111 [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:- ex:UTF-8)

Next

Get started with Asciidoctor and learn its core concepts.