How to setup Hexo
A simple process for creating a simple website.
Hexo is a great way to create a simple website. It works well for blogs, resume sites, and small business sites that don’t include an online store.
In this article, I will show you how to install and setup Hexo for a website. It’s simple, now that have done it 3 times. Also, the first time I had to make a bunch of choices along the way, and that always takes time.
Before you install Hexo
Before you install Hexo, you need to install a programming language called Javascript. The version of Javascript we will use is also called NodeJS. Then we will run some NodeJS commands that install Hexo as an addon for Javascript.
I will provide a bit more details for Windows users.
Download NodeJS
Go to the NodeJS download page. Download and install the “LTS” version of NodeJS for your operating system.
Windows users:
- Choose the “msi” installer.
- If you are not sure whether to get 64-bit or 32-bit, try this:
For Windows 10, try the 64bit installer first. Only download the 32-bit installer if the 64-bit installation fails with a message saying something like “This is not a 64-bit version of Windows”.
For older versions of Windows, like Windows 7 and 8, just download and install the 32-bit installer. - Chocolatey users on Windows: You can install NodeJS with:
choco install nodejs-lts
Open a command line window
- On Windows you need to open the “Command Prompt” in “Administrator mode”. In the Start menu, right-click on “Command Prompt”. Choose “Run as Administrator”.
Install Hexo
First, install the Hexo package
Run this command to install the Hexo package for NodeJS:
- npm install hexo-cli -g
Create your project
Change directory (cd) to the folder where you will create your new Hexo folder. Don’t create the new folder yet, because the command to install the Hexo configuration files will create the folder for you.
Decide on the project name, which you will use as a folder name here, and later as part of the web address. It must have NO spaces in the name.
- Examples: myblog, health_blog, writing-blog, kidsBlog, foodBlog
You will use that name in the following commands, so let’s say you picked the name cat_blog.
Run the following command:
- hexo init cat_blog
Change directory (cd) to the new folder
- cd cat_blog
Install the required Javascript files for Hexo:
- npm install
You have now installed everything you need.
Test your installation
You can run a local Hexo web server to view your new blog in your web browser.
- hexo server
To see the blog In your browser, open a new tab and enter the web address:
- localhost:4000
This is a simple sample website, ready for you to edit it.