how to install jekyll 安装jekyll教程

This is my jekyll Installation steps

1. Install rvm

  • Before any other step install mpapis public key
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
  • Install RVM (development version)
curl -sSL https://get.rvm.io | bash

2. Install ruby

  • Change RVM installation souces to ruby-china server(optional)
echo "ruby_url=https://cache.ruby-china.org/pub/ruby" > ~/.rvm/user/db
  • List ruby versions on rvm
rvm list known
  • Install ruby lastest version, my version is 2.3.0
rvm install ruby
gem install bundler

3. Create a local repository for your Jekyll site

  • Initialized empty Git repository in /Users/octocat/my-site/.git/
  • Creates a new file directory on your local computer, initialized as a Git repository
git init `my-jekyll-site-project-name`
  • Changes the working directory
cd `my-jekyll-site-project-name`
  • Switched to a new branch ‘gh-pages’
  • Creates a new branch called ‘gh-pages’, and checks it out
git checkout -b gh-pages

4. install Jekyll using bundler

  • Create a file and its content is:
source 'https://rubygems.org'
gem 'github-pages', group: :jekyll_plugins`

(Source can be changed , such as ‘https://gems.ruby-china.org’)

  • Name the file Gemfile

  • Install jekyll and other dependencies from the GitHub Pages gem:

bundler install
  • Create jekyll template site
bundle exec jekyll new . --force

5. Run your Jekyll site locally!

bundle exec jekyll serve

Now preview your local jekyll site in your web browser at “http://localhost:4000”