Building environment for Jekyll



Creating virtual machine

At the end of creation, GUI didn’t appear.

Follow steps1 :

  • Restore the /etc/issue file
sudo mv /etc/issue.backup /etc/issue
  • Restore the /etc/rc.local file:
sudo mv /etc/rc.local.backup /etc/rc.local
  • Restore the /etc/init/gdm.conf file:
sudo mv /opt/vmware-tools-installer/gdm.conf /etc/init
  • Reboot

Then login and change repositories

sudo apt-get install gksu
gksu software-properties-gtk

then

sudo apt-get update
sudo apt-get upgrade

Install google-chrome

#32bit
wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb
sudo dpkg -i google-chrome-stable_current_i386.deb

#64bit
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb 

#encounter error
sudo apt-get install -f

Installing ruby from source code2 3

First we need to install some development tools and libraries that Ruby needs to compile. Run the following commands from your terminal:

sudo apt-get install build-essential vim git-core curl

sudo apt-get install bison openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev

sudo apt-get install libcurl4-openssl-dev libopenssl-ruby apache2-prefork-dev libapr1-dev libaprutil1-dev

sudo apt-get install libx11-dev libffi-dev tcl-dev tk-dev  

The above contents referenced are from Paul’s Software Blog2.Some libraires may have been out of date or got higher version during installation.There’re hints on the terminal. For me,there’re:

E: Package 'libopenssl-ruby' has no installation candidate
Note, selecting 'apache2-dev' instead of 'apache2-prefork-dev'

so I ignored “libopenssl-ruby” and change “apache2-prefork-dev” to “apache2-dev”.

Download the tarball and extract it.Change directory to the folder extracted;compile and install.

tar -xzf ruby-2.2.3.tar.gz
cd ruby-2.2.3
./configure
make
sudo make install

After installation,run

ruby -verion

to test whether ruby installed successfully or not.

Installing Jekyll4

1.Install bundler

sudo gem install bundler

2.Select a directory and clone the repository

git clone https://github.com/username/username.github.io

3.Change directory to username.github.io and create Gemfile

cd username.github.io
touch Gemfile
vi Gemfile

Add following contents to Gemfile while beyond the Great Wall:

source 'https://rubygems.org'
gem 'github-pages'

Or add following contents to Gemfile while inside the wall:

source 'http://mirrors.aliyun.com/rubygems/'
gem 'github-pages'

4.Run

bundle install

5.In the root of repository

sudo bundle exec jekyll serve

6.Encounter an error:Could not find Javascript runtime5.Run:

sudo apt-get install nodejs

Now,site can be accessed at

http://localhost:4000

 Toc
 Tags