Skip to content

Instantly share code, notes, and snippets.

@aahan
Last active December 15, 2015 08:39
Show Gist options
  • Save aahan/5232097 to your computer and use it in GitHub Desktop.
Save aahan/5232097 to your computer and use it in GitHub Desktop.

Pre-requisites

Server running Debian/Ubuntu Server with Nginx webserver set up.

Initial setup

Update System

sudo apt-get update && sudo apt-get upgrade

Install Git

sudo apt-get install git

Install Ruby using Ruby Version Manager

Ubuntu Server comes with Curl, so you won't need this (just know that Curl is needed):

sudo apt-get install curl

Ruby & Ruby Gems without RVM:

apt-get install ruby ruby-dev rubygems build-essential

Install RVM:

The carriage returns in the cURL request examples that are part of the cURL syntax are escaped with a backslash ('') in order to avoid prematurely terminating the command. (via)

\curl -L https://get.rvm.io | bash -s stable

And be sure to follow any subsequent instructions as guided by the installation process. For example, in my case, it was like this:

So, what does it say?

  1. Add the following line to ~/.bash_profile or ~/.bash_login, whichever exists.

     source ~/.profile
    

    .bash_profile exists in my case, so I edited it as suggested.

  2. Before you start using RVM, run the following command in all your open shell windows, then (it's best to) exit out of your shell session(s) and start up new one(s).

     source ~/.rvm/scripts/rvm
    
  3. Read output of rvm requirements and rvm notes commands. So, I did (it's very very important, IMO).

    As you can see rvm requirements command told me to do this:

     sudo apt-get update
    
     sudo apt-get --no-install-recommends install bash curl git patch bzip2
    
     sudo apt-get --no-install-recommends install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev
    

Install Ruby 1.9.3 and the latest version of RubyGems:

rvm install 1.9.3
rvm use 1.9.3
rvm rubygems current

Run ruby --version to be sure you're using Ruby 1.9.3.

Install Jekyll

gem install jekyll

Now's the real deal. Create the directory where you'll be storing all the source/files related to your Jekyll site, and cd to it.

mkdir ~/jekyll
cd jekyll

Configuration

Drop your Jekyll site source (templates, plugins, etc) under ~/jekyll. One way to check if you are doing it right is to check if this file exists ~/jekyll/_config.yml.

(If you are a newbie and in need of a starter template to understand site structure and stuff, jekyll/site directory from the official repository should be a good starting point.)

Markdown Interpreter: Redcarpet

I prefer to use Redcarpet instead of Maruku or RDiscount for markdown, as I like GitHub Flavored Markdown, and especially because GitHub uses it.

Install Redcarpet gem:

gem install redcarpet

Then add this line in your _config.yml file:

markdown: redcarpet

(or simply issue the command jekyll --redcarpet -- THIS IS WHERE I GET THE ERROR)

Pygments

Install:

sudo apt-get install python-pygments

Pick one of the supported theme styles for Pygments, and generate the CSS file by running the command:

pygmentize -f html -S default -a .highlight > pygments.css

Don't forget to replace default in the command with the identifier for the theme style of your choice. To get a list of all available styles, run theese 4 commands in succession:

python

>>> from pygments.styles import get_all_styles
>>> styles = list(get_all_styles())
>>> styles

And reference the css style in your HTML template (see links below). I am using the GitHub Style theme for Pygments.


Jekyll's supported Markdown parsers: https://github.com/jekyll/jekyll/tree/master/lib/jekyll/converters/markdown


JavaScript Runtime


If using Pygments, you need to install Python:

apt-get -y install python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment