最近准备搭建一个博客平台,也看了不少开源的博客框架。好比Solo、wordpress等框架、自已曾经也在cnblog发布过几篇文章、东写写西写写、杂乱无章的。后续能够写一个自动同步各平台的程序~~~node
Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown(或其余渲染引擎)解析文章,在几秒内,便可利用靓丽的主题生成静态网页。c++
本过程的安装环境:github
[root@luisyang tmp]# uname -a
Linux luisyang 3.10.0-327.36.3.el7.x86_64 #1 SMP Mon Oct 24 16:09:20 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
下载NodeJS,我选择的是Source Code
的版本。采用编译安装的方式。
Linux下能够经过wget命令直接下载、不须要下载到本地,在上传到远程服务器。sql
yum install -y gcc gcc-c++ make
cd /opt
wget https://nodejs.org/dist/v6.11.0/node-v6.11.0.tar.gz
解压安装:npm
tar xvf node-v6.11.0.tar.gz
cd node-v6.11.0
./configure
make
make install
cp /usr/local/bin/node /usr/sbin/
查看当前安装的Node版本
node -v
查看当前安装npm版本 ---相似于Linux下面的yum
npm -v
Github
提供经过Github Pages搭建我的主页。 Hexo
的deploy
命令能够将生成文章的静态文件部署到远程Github服务器。也能够经过GitHub
动态管理维护自已的文章。
基于这些前提、决定先在自已的Linux服务器[CentOS 7]
中构建Git环境。
vim
//先安装git依赖的包
yum install zlib-devel
yum install openssl-devel
yum install perl
yum install cpio
yum install expat-devel
yum install gettext-devel
//安装autoconf
yum install autoconf
//安装git
wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.xz
xz -d git-latest.tar.xz
tar xvf git-latest.tar
cd git-{date}
autoconf
./configure --with-curl=/usr/local
make
make install
安装Git
的步骤大同小异,下载包、安装、配置、配合命令使用既可
起步 - 安装 Git
安装Git
tomcat
cd /opt
npm install hexo-cli -g
hexo init blog
cd blog
npm install
hexo server
hexo命令
:服务器
Usage: hexo <command>
Commands:
help Get help on a command.
init Create a new Hexo folder.
version Display version information.
Global Options:
--config Specify config file instead of using _config.yml
--cwd Specify the CWD
--debug Display all verbose messages in the terminal
--draft Display draft posts
--safe Disable all plugins and scripts
--silent Hide output on console
For more help, you can use 'hexo help [command]' for the detailed information
or you can check the docs: http://hexo.io/docs/
通常我都是采用后台的方式启动Hexo Servermarkdown
nohup hexo server -p 80 >/dev/null 2>&1 &
Kill后台进程:
ps -ef | grep hexo #得到Hexo的后台进程
kill -9 pid #杀死进程
Hexo的主题默认存放在blog根目录下的themes目录[/opt/blog/themes]
下。默认主题:landscape
本博客采用开源的next主题。外观炫酷吊炸天,简洁明了,博主对常见的配置问题都作了很清晰的讲解。构建起来也比较简单
下载主题
cd /opt/blog
git clone https://github.com/iissnan/hexo-theme-next themes/next
启动主题
vi /opt/blog/_config.yml
找到thems属性,修改成next.重启便可。
启动服务
hexo server
一个简单的Hexo博客
就搭建好了。【本文中的Git环境
是为另一篇文章构建基础~~~~】