This post is roughly 10 years old; originally published on March 31, 2014! The information presented here may be out of date and inaccurate.
Nikola is a static site and blog generator written in Python that I’ve been using for a good while now. This blog post describes how to install Nikola on Debian. Now, this may look like a long winded way to install Nikola, given that Debian .deb package exist, but in my opinion it is the correct way to install Nikola on Debian.
First you’ll need Python and virtualenvwrapper
sudo apt-get install libpython2.7 python2.7 python2.7-dev python2.7-minimal
Remove any apt
installed Python packages that we are about to replace. The
versions of these packages in the Debian repositories soon get stale.
sudo apt-get purge python-setuptools python-virtualenv python-pip python-profiler
Install pip
.
wget https://bootstrap.pypa.io/get-pip.py
sudo python2.7 get-pip.py
Use pip
to install virtualenv
and virtualenvwrapper
.
sudo pip install virtualenv --upgrade
sudo pip install virtualenvwrapper
Create a “Snakepit” directory for storing all the virtualenvs.
mkdir ~/Snakepit
Add the following your ~/.bashrc
to enable virtualenvwrapper
.
export WORKON_HOME=${HOME}/Snakepit
if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
source /usr/local/bin/virtualenvwrapper.sh
elif [ -f /usr/bin/virtualenvwrapper.sh ]; then
source /usr/bin/virtualenvwrapper.sh
fi
Open a new shell to ensure that the virtualenvwrapper
configuration is active.
The following will create a new virtualenv called nikola
based on Python 2.7.
mkvirtualenv -p /usr/bin/python2.7 ~/Snakepit/nikola-640
To activate an existing virtualenv do the following.
workon nikola-640
You can switch to another virtualenv at any time, just use workon envname
.
Your shell prompt will change while a virtualenv is being worked on to
indicate which virtualenv is currently active.
While working on a virtualenv you can pip
install what you need or manually
install any Python libraries safe in the knowledge you will not adversely
damage any other virtualenvs or the global packages in the process. Very
useful for developing a new branch which may have different library requirements
than the master/head.
When you are finished working in a virtualenv you can deactivate it by
simply executing deactivate
.
Nikola is will be powered by Python 2.7 and some additional packages will be required.
sudo apt-get install python2.7-dev libfreetype6-dev libjpeg8-dev libxslt1-dev libxml2-dev libyaml-dev
python2.7-dev
provides the header files for Python 2.7 so that Python
modules with C extensions can be built.The following are required to build pillow
, the Python imaging library.
libjpeg8-dev
libfreetype6-dev
The following are required to build lxml
, a Python XML library.
libxml2-dev
libxslt1-dev
The following are required to build python-coveralls
.
libyaml-dev
Download Nikola.
mkdir -p ${VIRTUAL_ENV}/src
cd ${VIRTUAL_ENV}/src
wget https://github.com/getnikola/nikola/archive/v6.4.0.tar.gz -O nikola-640.tar.gz
tar zxvf nikola-640.tar.gz
cd nikola-6.4.0
Install the Nikola requirements.
pip install -r requirements-full.txt
If you intend to use the Nikola planetoid (Planet generator) plugin you’ll also need to following.
pip install peewee feedparser
Actually install nikola.
python setup.py install
Nikola is now installed. nikola help
and the Nikola Handbook
will assist you from here on.