此篇只介绍安装以及本地运行然后127.0.0.1浏览器访问,后续部署(Github Pages + 服务器)、美化之后有时间✍️补上
介绍
Hexo 是一个快速、简洁且高效的博客框架。 Hexo 使用 Markdown(或其他标记语言)解析文章,在几秒内,即可利用靓丽的主题生成静态网页。Hexo是基于Node.js和Git工具的静态博客。
开始安装
安装Git
你可以选择vps来作为博客的本地,也可以用你的电脑,两者并无区别。选择对应系统的安装方式。
Windows:下载并安装git。( https://git-scm.com/downloads/win )
Mac:使用 Homebrew, MacPorts 或者下载 安装程序。
Linux (Ubuntu, Debian):sudo apt-get install git-core
Linux (Fedora, Red Hat, CentOS):sudo yum install git-core
安装Node.js
Windows
# Download and install fnm:$ winget install Schniz.fnm# Download and install Node.js, you can choose the version on the offical 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 offical 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
安装 Hexo
所有必备的应用程序安装完成后,即可使用 npm 安装 Hexo。
$ npm install -g hexo-cli
安装 Hexo 完成后,请执行下列命令,Hexo 将会在指定文件夹中新建所需要的文件。<folder>
填入你选择的博客的根目录。
$ hexo init <folder>$ cd <folder>$ npm install
请将<folder>
换成你所希望设置的博客根目录的名称,可自定义。至此,Hexo博客已安装完成。
此时,你可以运行hexo -s
在本机上运行,然后在浏览器127.0.0.1+端口访问
之后的部署(Github Pages + 服务器)、美化后续会补上,今天先写那么多,多水几个帖子