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.
The 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
Install the version you have chosen by running the following:
Ubuntu should have git
already installed, but if it is not, run:
Use npm
to install the hexo
package globally (using the -g
flag)
Initialize a blog folder and install all dependencies.
Modify the options in _config.yml
file which should be in the folder created by hex init
command. The following configuration options are of interest.
Start the hexo server by running the following:
This 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:
Edit the _config.yml
to include the name of the theme to light
as follows:
Install forever
globally.
Install hexo in the blog
folder.
Create a app.js
file under blog
directory as follows:
Now you can use forever
to start and stop the server as follows
Generate the site and deploy at the same time using:
For 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.