Date

As with any start of a project there must be a first step, and for a new blog often that first step involves setting up the blog and making a first post. Rather than splitting my focus between setting up the blog and one of the handful of topics I'd like to write up, the first post is about how I've setup this blog, and some of the possible improvements I might do to improve it in the future. Even though there are dozens to hundreds of posts on this topic, putting the new system through its paces and getting a chance to practice has significant value.

Arrange for hosting

There is a spectrum of choices for how to host a site from commercial hosting(such as godaddy.com, 1and1.com, etc), to virtual servers(Amazon AWS, Google App Engine, Rackspace, etc), to hosting the site directly on physical hardware. I already have a Debian server located in a datacenter with enough spare resources to host a small KVM based guest, and a script to spin up a new Debian guest. So the first step is as simple as:

ssh root@[remote server address]
tmux attach
./gen_new_guest.sh [guest name] [static ip]

Basically this script does the following:

  • takes a Debian preseed template and makes a copy naming the copy after the first paramater(new guest hostname)

  • runs two perl oneliners to replace the hostname and ip address on the new copy

  • creates a new LVM logical volume

  • calls virt-install passing in the preseed file and the LVM LV path

Now it's just a matter of waiting while the Debian net-install takes all of the default options from the preseed file and runs through the installation menu. If the installer adds or changes a menu option, then the installation will wait for you to make a selection.

Confirm SSH access to hosting

Once the guest has finished installing it's time to log in and run through the [hardening](https://www.debian.org/doc/manuals/securing-debian-howto/index.en.html] checklist. After a while this process becomes routine, and much of it is scriptable or is related to policy rather than configuration. ssh-copy-id is one way to setup secure remote ssh access before disabling root password login.

ssh-copy-id root@[static ip or host domain name]

You'll know it worked if you can ssh into root now without being prompted for a password, but if you have never created an ssh key pair you will need to first run:

ssh-keygen

Create git repo to hold and track blog, then generate initial(default) site

I've selected Pelican and it has a good quickstart guide.

sudo apt-get install python-pip
sudo pip install pelican
sudo pip install Markdown
mkdir /usr/local/src/[repo name]/
cd /usr/local/src/[repo name]/
pelican-quickstart

pelican-quickstart has a series of questions from which it generates a pelicanconf.py configuration file.

Publish default site

I've elected to use nginx for this site, so the default web root is /usr/share/nginx/www/ and if pelican is setup properly it's now a matter of just running:

make ssh_upload

After checking in your favorite browser that you see a pelican site and not the default nginx index file, you're good to go.

Update default links and add Google analytics

It appears the settings are well documented here. Initially the only ones I was interested in changing were:

  • LINKS
  • GOOGLE_ANALYTICS
  • SOCIAL
  • TIMEZONE
  • RELATIVE_URLS

Zeno's Paradox(make obligitory first post)

Now in preparation to publish the first article some house cleaning by updating/creating a .gitignore file:

\#*
*~
*.pyc
output/*

Then updating the site is as simple as:

git add .
git commit
make ssh_upload