示例页面
一、创建gitee仓库
firefox https://gitee.com/
二、部署软件
1.切换为国内阿里yum源
# 备份原有repo文件
tar -zcf /etc/yum.repos.d/old.tgz /etc/yum.repos.d/
# 删除原repo文件
rm -f /etc/yum.repos.d/*.repo
# 下载阿里基本源
curl http://mirrors.aliyun.com/repo/Centos-7.repo -o /etc/yum.repos.d/Centos-Base.repo
# 下载阿里epel源
curl http://mirrors.aliyun.com/repo/epel-7.repo -o /etc/yum.repos.d/Centos-epel.repo
# 清理并显示已配置源
yum clean all && yum repolist
2.部署nodejs
[root@gitee ~]# yum -y install nodejs #安装nodejs
[root@gitee ~]# node -v #查看node版本
v6.16.0
[root@gitee ~]# npm -v #查看npm版本
3.10.10
3.部署git
[root@gitee ~]# yum -y install git #安装git
[root@gitee ~]# git --version #查看git版本
git version 1.8.3.1
git全局配置:
[root@gitee ~]# git config --global user.name "xinsui1314x" #gitee的用户名
[root@gitee ~]# git config --global user.email "[email protected]" #gitee的邮箱
clone仓库:
[root@gitee ~]# git clone https://gitee.com/xinsui1314x/xinsui1314x.git #克隆项目
[root@gitee ~]# cd xinsui1314x/ #进入克隆的项目
4.部署hexo
[root@gitee xinsui1314x]# npm -g install hexo #安装hexo
[root@gitee hexo]# hexo --version #查看hexo信息
hexo: 3.8.0
hexo-cli: 2.0.0
os: Linux 3.10.0-693.el7.x86_64 linux x64
http_parser: 2.8.0
node: 6.16.0
v8: 5.1.281.111
uv: 1.27.0
zlib: 1.2.7
ares: 1.10.1-DEV
icu: 50.1.2
modules: 48
napi: 3
openssl: 1.0.2k-fips
[root@gitee xinsui1314x]# mkdir hexo #在克隆的项目创建hexo目录
[root@gitee xinsui1314x]# cd hexo/ #进入目录
[root@gitee hexo]# hexo init #初始化hexo
[root@gitee hexo]# npm install hexo-deployer-git --save #安装hexo插件,自动配置到gitee
[root@gitee hexo]# ls -A1 #查看hexo目录结构
_config.yml #站点的配置文件
db.json #文件
.deploy_git #由hexo g命令自动生成
.gitignore #推送时忽略的文件
node_modules #安装包目录,执行npm install命令自动生成
package.json #安装包的名称
public #由hexo g命令生成的静态网页目录
scaffolds #文章的模板
source #博客文章的.md文件
themes #存放主题的文件夹
5.clone主题(可选,hexo提供了默认主题)
[root@gitee hexo]# firefox https://hexo.io/themes/ #hexo的主题网站
将主题存放在theme文件夹中
三、部署网站
1.修改站点配置文件
[root@gitee hexo]# vim _config.yml
:set nu
5 # Site
6 title: gitee #标题
7 subtitle: pages测试 #子标题
8 description:
9 keywords:
10 author: X #作者
11 language: zh-cn #语言
12 timezone: #指定时区,默认使用浏览器时区
14 # URL
16 url: http://xinsui1314x.gitee.io/ #网站访问地址
17 root: / #根目录
18 permalink: :year/:month/:day/:title/
19 permalink_defaults:
73 # Extensions
74 ## Plugins: https://hexo.io/plugins/
75 ## Themes: https://hexo.io/themes/
76 theme: landscape #使用的主题,对应themes中的目录名
80 deploy:
81 type: git #使用的自动配置方式
82 repo: https://gitee.com/xinsui1314x/xinsui1314x.git #项目地址,要与type对应
83 branch: master #使用的项目分支
2.生成页面并配置到gitee
[root@gitee hexo]# hexo clean && hexo g && hexo d
# hexo clean #清理生成的文件和缓存
# hexo generate #生成静态网页文件
# hexo deploy #部署到网站
3.gitee更新pages
4.访问pages
firefox http://xinsui1314x.gitee.io