When creating this website I wanted a blog that would be written with Markdown,
used no databases, and was easy to add features to. I found that the
Pelican static site generator met those requirements (and it's written with
You can easily use git to download the Pelican source code so we can configure
it for your server (
sudo yum install git if you don't have it yet).
git clone https://github.com/getpelican/pelican
I like to keep this directory around and do a
git pull every once in a while
to make sure I'm getting the latest and greatest version of Pelican. At the time
of writing, Pelican is on version 3.6.3.
Go in to the Pelican directory and install it's dependencies by issuing the
sudo python setup.py install
Since I want to write these blog posts using Markdown syntax, I needed to
install the Markdown python package:
pip install Markdown
But it was already installed. Nice.
If you don't have pip, the following commands will get you there on CentOS 7:
sudo yum install epel-release
sudo yum install python-pip
Create a Pelican project
Run the quickstart command to configure your Pelican project:
And answer away! I placed my project in another directory, "~/gridc0-pelican" so
I didn't clutter the git repo. I highly recommend installing the "auto-reload
and simpleHTTP script" feature to aid in development.
If you placed your project in a specific directory then
cd there before
Let's create a simple test file in the content directory named test.md. The
contents look like so:
Title: Markdown test
Tags: Pelican, Markdown
Authors: Walt Elam
Summary: Test file for Markdown posts on Pelican
# Hello, World!
The default port that the test server will serve your website on is 8000, so we
need a firewall rule to allow that traffic:
sudo firewall-cmd --zone=public --add-port=8000/tcp
You can also provide
--permanent if you wish to keep that rule around for
future development. Otherwise, the rule will be gone when firewalld restarts.
And finally we'll both generate and serve the content in one fell swoop with the
In a browser, visit your domain/IP address and specify port 8000 to view your
Publish your site
Now that everything is working, we need to put the generated files in our web
directory so that they will be served in a more normal fashion (i.e. without
having to specify port 8000).
First, stop the devserver:
If you list the contents of the "output/" directory, you'll see a bunch of files
that look like a website. That's because it is a website. Your website! Copy the
contents of that directory to wherever you serve web files from, set the
permissions correctly, and you should have published your website. On my default
CentOS installation, the following commands were issued to move my files to the
sudo rm -rf /var/www/html/*
sudo cp -R output/* /var/www/html/
And you're all set. You may wish to configure your website a bit in order to
style it more to your liking and I recommend browsing the official Pelican
documentation to learn more about that process.