安装hexo
来自ling
window上安装
- 下载nodejs最新版本
- 执行Npm全局目录
- 安装npm
D: cd D:\server\nodejs npm install npm@latest npm -v
- 安装cnpm
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
安装完之后,安装模块的命令就变为:
$ cnpm install [name]
同步模块命令为:
$ cnpm sync connect
- 安装hexo
参考[1] cd D:\workspace\source\hexo.git hexo init cnpm install hexo server http://localhost:4000/
linux安装
cd /alidata/server/blog
export PATH=$PATH:/alidata/server/node-v6.7.0-linux-x64/bin hexo s nohup hexo server -p 4000 & logout
hexo generate cp -r -f /alidata/server/blog/public/* /alidata/www/ling2
hexo deploy
git 102010cncger Wb191010610109
- 安装nodejs
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
- 安装git
sudo yum install git-core
- 安装hexo
cnpm install hexo-cli -g cnpm install hexo-server --save #安装路径设置,默认会安装在当前目录的blog目录中,blog目录不用自己创建 cd /alidata/server/ hexo init blog cd blog cnpm install hexo server
- 安装admin
cnpm install --save hexo-admin
_config.yml
admin: username: bo.wang password_hash: $2a$08$rb7xsVYco/rEqvb8fUFnd.eptiT/dpDdzBU1sQsZpnqUJ2op6QUdO secret: Wb191010610109
- 安装皮肤
git clone git@github.com:winnerweb/hexo-theme-smackdown.git themes/smackdown
_config.yml
theme: smackdown
- 更新主题
cd themes/modernist git pull
- 配置
参考创建Repository并绑定本地博客到github上 Hexo搭建Github静态博客
- 创建Repository并绑定本地博客到github上 创建的时候注意Repository的名字。比如我的Github账号是102010cncger,那么我应该创建的Repository的名字是:102010cncger.github.io。
- 之后找到根目录下的_config.yml文件,修改最后几行如下
deploy: type:git repository:https://github.com/102010cncger/102010cncger.github.io.git branch:maste
检查是否已经存在了SSH keys。
ls -al ~/.ssh
- 输入以下指令(邮箱就是你注册github时候的邮箱)后,回车:
ssh-keygen -t rsa -C "102010cncger@sina.com"
ssh-agent -s ssh-add ~/.ssh/id_rsa
输入之后,在我这里是出错了,不知道你的有没有出错。 image 如果你的也是这样子出错了的话,就输入以下指令:
eval `ssh-agent -s` ssh-add
到了这一步,就可以添加SSH key到你的Github账户了。键入以下指令,拷贝Key(先拷贝了,等一下可以直接粘贴):
cd /root/.ssh/ vi id_rsa.pub
复制里面的内容
之后进入你的github,设置你的SSH
输入你的Github密码即可完成SSH Key的添加。键入以下命令:
ssh -T git@github.com
你可能会看到有警告,输入“yes”就好。