Principal Software Engineer Works at Oath: (which acquired Millennial Media) (which acquired Nexage) Lives in Atlanta, GA
Java developer, currently into Scala, likes to tinker, tries to solve all problems in life by writing code and loves the great indoors!
[ Blog ]
I have been searching for a simple and lightweight self hosted blogging platform that is suitable for programmers and I might have found the one! Hexo.
Here is a 10 minute installation to get it up and running.
The only requirements are :
The best way to install Node.js is installing with nvm.
curl https://raw.githubusercontent.com/creationix/nvm/v0.17.2/install.sh | bashThe above script clones the nvm repository and also adds the source line to ~.bashrc (or ~/.bash_profile or ~/.profile)
Run the following to get a list of all the Node.js versions available and choose the version to install
nvm ls-remoteInstall the version you have chosen by running the following:
nvm install 0.11.14Ubuntu should have git already installed, but if it is not, run:
sudo apt-get install git-coreUse npm to install the hexo package globally (using the -g flag)
npm install -g hexoInitialize a blog folder and install all dependencies.
hexo init blog
cd blog
npm installModify the options in _config.yml file which should be in the folder created by hex init command. The following configuration options are of interest.
title: [Blog Title]
subtitle: [Sub Title]
description:
author: [Name]
email:
language: [IETF format]
port: [port number]
server_ip: [ip address to bind]
logger: true
logger_format: defaultStart the hexo server by running the following:
hexo serverThis will start the server at the IP address and port specified in _config.yml file.
The themes are installed under themes directory which is under the root directory (which is blog in this case)
To install a theme like light do the following:
git clone https://github.com/hexojs/hexo-theme-light.git themes/light
cd themes/light
git pullEdit the _config.yml to include the name of the theme to light as follows:
theme: lightInstall forever globally.
npm install -g foreverInstall hexo in the blog folder.
npm install hexo --saveCreate a app.js file under blog directory as follows:
require('hexo').init({command: 'server'});Now you can use forever to start and stop the server as follows
forever start app.js
forever stop app.js
forever restart app.jsdeploy:
type: github
repo : git@github.com:[reponame] # usually username/username.github.io
branch: masterGenerate the site and deploy at the same time using:
hexo generate --deployFor further documentation see the Hexo Documentation.
Pro tip - if you are monkeying about with different Hexo themes, make sure you delete the db.json file in the root folder before you generate/deploy. I’m not sure what that thing is, but some theme garbage can get jammed up in there and it won’t show up running hexo server but it will maddeningly appear when you generate the site.