Build the book's site HTML locally
In order to locally build your book's HTML with Jekyll, you'll take one of two approaches:
- Install a copy of the Ruby language (which is a free open-source language, but can be a pain to install).
- Use a container software (Docker or Singularity) along with a Docker image that we'veprepared for youfrom this Dockerfile.
We recommend installing Ruby with one of the supplied methods first, and if this fails,try installing with a container tool such as Docker.
If you wish to use GitHub's Jekyll builder then you can skipthis section, because GitHub will automatically build your book'sHTML with its own version of Jekyll. In this case, skip to.
The most straightforward way to build your book's HTML is to installRuby and Jekyll.
In this case, you'll need Ruby, an open-source programming language, to build your book'sHTML. You won't need to know how to program in Ruby, we'll just use some tools that utilizeRuby's libraries.
There are a few different methods for installing Ruby, and their ease will dependon the operating system that you're using (in general, platforms are morestraightforward to use for installing Ruby).
In the following sections we'll cover a few ways to install Ruby, they are roughly orderedfrom most-straightforward to most-difficult. Once you've finished those steps,head to install ruby plugins and follow the directions.
Using the conda-forge recipe rb-github-pages
The easiest way to install Ruby on nix systems is to usethe conda
* package manager. On some systems the following should work:
This will install pre-compiled binaries for the Ruby package GitHub pages, Jekyll, and all of their dependencies. If this works for you, you can skip straight to the section using make install
.
Using the official Jekyll instructions
The Jekyll Documentation provides their own set of instructionsfor how to install Ruby locally on your system. These are a bit more involved, but ingeneral should work for many operating systems. Here are a few links to OS-specificinstructions.
Using conda-forge to install Ruby from scratch
If you are on a platform for which the rb-github-pages
package isn't available, you can also try install Ruby and a C++ compiler manually using conda
, as follows:
- conda install -c conda-forge ruby
Install clang compilers
On OSX
Two steps are needed on OSX. First, install the 's clang compiler:
- conda install -c conda-forge clangxx_osx-64
If you are running OSX 10.14 (Mojave) you also need to install system libraries inthe default *nix locations by running
- open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
On Linux
Install conda
's clang compiler:
Regardless of the approach used above, you'll next installthe Ruby plugins for your specificbook. To do so, change into your book's directory, and run
- make install
which will install the following things:
- Bundler (a Ruby dependency management tool) if it is not already installed(e.g. by running
conda install -c conda-forge rb-github-pages
)
Once you have Ruby installed, you can preview your book'ssite locally by running this command:
make serve
This should run Jekyll, building your site, and then open up a port on your computer with a live version of the book.It will generate your book's HTML in the _site/
folder. This collection of files makes afunctioning static website.
If you'd like to only build your book's HTML without previewing the site, you cando this with the following command:
- bundle exec jekyll serve
Once the collection of HTML files is in , you can move on to.
If the above steps do not work for you, then you can try building yourbook's HTML with containers.
Containers canprovide an easier installation for many systems.If you are developing on a system where you have administrator privileges(i.e., you have root
permissions), we recommend you use .
First, you'll need to make sure you have Docker installed.There are installation instructions for each operating systemto guide you through this process.
Once Docker is available on your system, you can build the image locally with:
You can then access this image with the following command.Make sure to specify the full path to your Jupyter Book, rather than the relative path!
- docker run --rm --security-opt label:disable \
- -v /full/path/to/your/book:/srv/jekyll \
- -p 4000:4000 \
- -it -u 1000:1000 \
- emdupre/jupyter-book
If you navigate to in your browser,you should see a preview copy of your book.If you instead see an error, please try to update your local book;see the Jupyter Book FAQ sectionfor more details on how to do so.
You'll find the HTML for your book in the _site/
folder.
If you are on a system where you do not have administrator privileges (such as a sharedcomputing cluster), you will not be able to use Docker.Instead, you can use Singularity.First, you'll need to check with your resource manager that Singularity is availableon your system.
You can then create a Jupyter Book Singularity image using:
- singularity build jupyter-book.simg docker://emdupre/jupyter-book
Next, you can access this image with the following command.Make sure to specify the full path to your Jupyter Book, rather than the relative path!
- singularity run -B /full/path/to/your/book:/srv/jekyll \
- --pwd /srv/jekyll \
- jupyter-book.simg
And that's it! If you navigate to in your browser,you should see a preview copy of your book.
Now that you've finished building the HTML for your book, it's time to host thecontent online. See one of the following pages for instructions on how to do this:
This page was created by