Hello World

Update 2019-06-16 - Using Anaconda to install Hexo

1
2
3
4
5
source ~/anaconda3/bin/activate
conda create -n hexo
conda activate hexo
conda install nodejs
npm install -g hexo

Welcome to my very first post! This blog was created using the blog framework Hexo. As this is my first post, I will detail how I set up Hexo and deployed to GitLab pages.

Setting up a development environment and installing Hexo

Before we begin coding, it is important to first set up a proper workspace. I will be using Linux and all my Git repositories will live in a single folder. The next important step in setting up a development environment is to have clean, organized package management. I will be using virtual environments to help with this aspect.

1
2
mkdir ~/venv && cd venv
python3 -m venv hexo

We can now install packages within this virtual environment that are separate from our system packages. If we make an mistake in our package installation, we can simply delete the virtual environment and its associated packages and make a new one. Another advantage of using virtual environments is that each Git repository can have its own environment with necessary packages for development.

Note: virtual environments must first be activated and packages must be installed using pip.

1
2
3
4
5
6
source hexo/bin/activate #activate hexo virtual environment
pip install nodeenv
cd ~/venv
nodeenv node #create another virtual environment based on node.js
source node/bin/activate #activate node virtual environment
npm install -g hexo-cli

Initializing the Hexo framework

Now that we have node.js and Hexo installed, we can begin setting up our blog. First we create an empty repository in GitLab with the name username.gitlab.io. We can then git clone in our local repository folder.

1
2
cd ./username.gitlab.io
hexo init

We should now have a basic Hexo framework within our folder. Before we push to our repo, we still need to add a .gitlab-ci.yml file. This file will contain instructions for how our repo will produce our blog. Examples of .gitlab-ci.yml files can be found online. Finally, we can push to our repo and we should be able to see our blog at username.gitlab.io.

Note: I won’t be covering how to make new pages or specific customizations in this post, there is plenty of documentation online.