Note: This article only covers installation and local operation for browser access via 127.0.0.1. Subsequent deployment will be discussed later.
Introduction
Hexo is a fast, simple, and efficient blogging framework. Hexo uses Markdown (or other markup languages) to parse articles and can generate static web pages with beautiful themes in seconds. Hexo is a static blog platform based on Node.js and Git tools.
Installation Guide
Installing Git
You may choose either a VPS or your personal computer as the local environment for your blog; there is no difference between the two. Select the installation method corresponding to your operating system.
Windows: Download and install Git. ( https://git-scm.com/downloads/win )
Mac: Use Homebrew, MacPorts, or download the installer.
Linux (Ubuntu, Debian): sudo apt-get install git-core
Linux (Fedora, Red Hat, CentOS): sudo yum install git-core
Installing Node.js
Windows
# Download and install fnm:
$ winget install Schniz.fnm
# Download and install Node.js, you can choose the version on the official website:
$ fnm install 22
# Verify the Node.js version:
$ node -v # Should print "v22.13.1".
# Verify npm version:
$ npm -v # Should print "10.9.2".
Mac
# Download and install fnm:
$ curl -o- https://fnm.vercel.app/install | bash
# Download and install Node.js, you can choose the version on the official website:
$ fnm install 22
# Verify the Node.js version:
$ node -v # Should print "v22.13.1".
# Verify npm version:
$ npm -v # Should print "10.9.2".
Linux
# Before you begin, ensure that curl is installed on your system. If curl is not installed, you can install it using the following command:
$ sudo apt-get install -y curl
# Download the setup script:
$ curl -fsSL https://deb.nodesource.com/setup_23.x -o nodesource_setup.sh
# Run the setup script with sudo:
$ sudo -E bash nodesource_setup.sh
# Install Node.js:
$ sudo apt-get install -y nodejs
# Verify the installation:
$ node -v
Installing Hexo
Once all prerequisite applications are installed, you may proceed to install Hexo using npm.
$ npm install -g hexo-cli
After Hexo installation is complete, execute the following commands. Hexo will create the necessary files in the specified folder. Replace <folder> with your chosen root directory for the blog.
$ hexo init <folder>
$ cd <folder>
$ npm install
Please replace <folder> with your desired name for the blog root directory, which can be customized. At this point, the Hexo blog installation is complete.
You may now run hexo -s to launch it locally, then access it via browser at 127.0.0.1 plus the port number.