Gangmax Blog

自由之思想,独立之精神

Setup Octopress Environment

| Comments

This is a note how to setup the Octopress environment on Ubuntu Xenial 16.04.

Install ”RVM” and “Ruby 1.9.3”

1
2
3
4
5
6
7
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
# After executing the commannds above, make you you have the following
# lines in the "~/.zshrc" file (I use zsh).
export PATH="$PATH:$HOME/.rvm/bin"
source "$HOME/.rvm/scripts/rvm"
rvm install 1.9.3

Install pyenv and “Python 2.7.13”

1
2
3
4
5
6
7
8
9
10
11
12
# 1. Download pyenv code.
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
# 2. Install dependencies(https://github.com/pyenv/pyenv/wiki/Common-build-problems).
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev
# 3. Add environment variables.
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshenv
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshenv
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.zshenv
# 4. Install Python instance in a new terminal window.
pyenv install 2.7.13

Install required Ruby gems

1
2
3
gem install bundler
cd ~/octopress
bundle install

Fix the “Invalid ELF Header in Ffi” error.

From here.

1
2
3
4
cp /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 ~/.pyenv/versions/2.7.13/lib/
cd ~/.pyenv/versions/2.7.13/lib/
mv libpython2.7.a libpython2.7.a.backup
mv libpython2.7.so.1.0 libpython2.7.a

Now you should be able to run “rake generate preview” to build nd preview the final result.

Comments