How to install Octopress in CentOS 6 and RHEL 6

In this tutorial we will learn,how to install Octopress in CentOS 6 and RHEL 6 (Red Hat).
Octopress is a framework for Jekyll.It is designed by Brandon Mathis. Octopress is easy to go setup.Like jekyll,you do not have to write your HTML templates,Javascripts,CSS and set up the configuration.

Requirement: Ruby 1.9.3 or greater

To install Octopress,follow the given below steps

Step 1: Install ruby in the system.If you already have Ruby 1.9.3 or greater then skip this step. I have already written a post on How to easily install ruby 2.1.0 in CentOS and RHEL.For more details read the post.

Below commands are, to install ruby version 2.1.0 by RVM

curl -L get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm requirements
rvm install 2.1.0
rvm use 2.1.0 --default
ruby -v

Step 2: Install git in the system

yum install git 

Step 3: We are cloning the Octopress source code from github in /opt .You can change the path as per your requirement

cd /opt

git clone git://github.com/imathis/octopress.git octopress

Below is the reference

[root@localhost opt]# git clone git://github.com/imathis/octopress.git octopress
Initialized empty Git repository in /opt/octopress/.git/
remote: Reusing existing pack: 10953, done.
remote: Counting objects: 17, done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 10970 (delta 3), reused 3 (delta 0)
Receiving objects: 100% (10970/10970), 2.86 MiB | 431 KiB/s, done.
Resolving deltas: 100% (5197/5197), done.
[root@localhost opt]#

Step 4: Now install dependencies.

cd /opt/octopress

gem install bundler

bundle install

Below is the reference

[root@localhost octopress]# gem install bundler
Fetching: bundler-1.5.2.gem (100%)
Successfully installed bundler-1.5.2
Parsing documentation for bundler-1.5.2
Installing ri documentation for bundler-1.5.2
Done installing documentation for bundler after 3 seconds
1 gem installed
[root@localhost octopress]# 
[root@localhost octopress]# bundle install
Fetching gem metadata from https://rubygems.org/.......
Fetching additional metadata from https://rubygems.org/..
Installing rake (0.9.2.2)
Installing RedCloth (4.2.9)
Installing chunky_png (1.2.5)
Installing fast-stemmer (1.0.1)
Installing classifier (1.3.3)
Installing fssm (0.2.9)
Installing sass (3.2.9)
Installing compass (0.12.2)
Installing directory_watcher (1.4.1)
Installing haml (3.1.7)
Installing kramdown (0.13.8)
Installing liquid (2.3.0)
Installing syntax (1.0.0)
Installing maruku (0.6.1)
Installing posix-spawn (0.3.6)
Installing yajl-ruby (1.1.0)
Installing pygments.rb (0.3.4)
Installing jekyll (0.12.0)
Installing rack (1.5.2)
Installing rack-protection (1.5.0)
Installing rb-fsevent (0.9.1)
Installing rdiscount (2.0.7.3)
Installing rubypants (0.2.0)
Installing sass-globbing (1.0.0)
Installing tilt (1.3.7)
Installing sinatra (1.4.2)
Installing stringex (1.4.0)
Using bundler (1.5.2)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
[root@localhost octopress]# 

Step 5: Install the default theme

rake install

Below is the reference

[root@localhost octopress]# rake install
## Copying classic theme into ./source and ./sass
mkdir -p source
cp -r .themes/classic/source/. source
mkdir -p sass
cp -r .themes/classic/sass/. sass
mkdir -p source/_posts
mkdir -p public
[root@localhost octopress]# 

Step 6: Now start the Octopress

cd /opt/octopress
rake preview

OR To keep running in background

nohup rake preview &

Note: Check the iptable because it runs on port no. 4000 by-default.Port 4000 must be allowed in IPTABLE.

Step 7: Open the Web browser and type http://ip-address-or-domain-name:4000
eg. http://192.168.56.101:4000 or http://example.com:4000

Octopress

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.