1. 安装nodejs10
下载安装nvm
https://github.com/coreybutler/nvm-windows/releases/download/1.1.9/nvm-setup.exe
安装配置nodejs
C:UsersAdministrator>nvm install 10
Downloading node.js version 10.24.1 (64-bit)...
Complete
Creating C:UsersAdministratorAppDataRoamingnvmtemp
Downlo服务器托管网ading npm version 6.14.12... Complete
Installing npm v6.14.12...
Installation complete. If you want to use this version, type
nvm use 10.24.1
C:UsersAdministrator>nvm use 10.24.1
Now using node v10.24.1 (64-bit)
C:UsersAdministrator>npm config set registry https://registry.npm.taobao.org -g
C:UsersAdministrator>npm config get registry https://registry.npm.taobao.org/
https://registry.npm.taobao.org/
2. 安装gitbook
C:UsersAdministrator>npm install gitbook-cli -g
C:Program Filesnodejsgitbook -> C:Program Filesnodejsnode_modulesgitbook-clibingitbook.js
+ gitbook-cli@2.3.2
added 578 packages from 672 contributors in 17.281s
C:UsersAdministrator>gitbook -V
CLI version: 2.3.2
Installing GitBook 3.2.3
...
GitBook version: 3.2.3
3. 配置gitbook
初始化
D:gitbook>gitbook init
warn: no summary file in this book
info: create README.md
info: create SUMMARY.md
info: initialization is finished
D:gitbook>gitbook serve
Live reload server started on port: 35729
Press CTRL+C to quit ...
info: 7 plugins are installed
info: loading plugin "livereload"... OK
info: loading plugin "highlight"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "sharing"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 1 pages
info: found 0 asset files
info: >> generation finished with success in 0.3s !
Starting server ...
Serving book on http://localhost:4000
目录结构
.
├── book.json
├── README.md
├── SUMMARY.md
├── chapter-1/
| ├── README.md
| └── something.md
└── chapter-2/
├── README.md
└── something.md
新建book.json
{
"plugins": [
"collapsible-menu",
"anchor-navigation-ex",
"tbfed-pagefooter",
"disqus",
"code",
"copy-code-button",
"expandable-chapters-small",
"-sharing",
"-lunr",
"-search",
"search-pro"
],
"title": "测试",
"language" : "zh-hans",
"pluginsConfig": {
"tbfed-pagefooter": {
"copyright":"Copyright Amadeus 2024",
"modify_label": "文件修订时间:",
"modify_format": "YYYY-MM-DD 服务器托管网HH:mm:ss"
},
"disqus": {
"shortName": "gitbookuse"
}
}
}
安装插件
D:gitbook>gitbook install
info: installing plugin "disqus"
runTopLevelLifecycles -> | |######################################################################################---|
D:gitbook
+-- gitbook-plugin-anchor-navigation-ex@1.0.14
+-- gitbook-plugin-collapsible-menu@1.0.3
+-- gitbook-plugin-disqus@0.1.0
`-- gitbook-plugin-tbfed-pagefooter@0.0.1
info: >> plugin "disqus" installed with success
D:gitbook>gitbook build
info: 11 plugins are installed
info: 10 explicitly listed
info: loading plugin "collapsible-menu"... OK
info: loading plugin "anchor-navigation-ex"... OK
info: loading plugin "tbfed-pagefooter"... OK
info: loading plugin "disqus"... OK
info: loading plugin "highlight"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "sharing"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 1 pages
info: found 0 asset files
warn: "options" property is deprecated, use config.get(key) instead
info: >> generation finished with success in 0.4s !
D:gitbook>gitbook serve
设置目录
去除gitbook发布字样
在book的根目录里创建styles文件夹,然后在其中创建website.css文件
.gitbook-link {
display: none !important;
}
book.json
{
"styles": {
"website": "styles/website.css"
}
}
4. 部署gitbook
安装nodejs10
参见《openEuler欧拉安装指定版本的nodejs》
配置git
- 步骤3中,本地代码上传到git
- 服务器中,新建目录 /home/gitbook , 然后git Pull
- 设置git pull免密,参见《openEuler欧拉设置git pull免密》
- gitbook install
- gitbook build
- 关闭防火墙
systemctl stop firewalld
systectl disable firewalld - gitbook serve
- 访问 http://服务器ip:4000 测试
自动化部署
测试没问题,在用户根目录 写个自动化部署脚本。每次执行前,先kill -9
`kill -9 `ps aux | grep gitbook | awk '{print $2}'``
gitbook.sh
cd /home/gitbook
git pull
gitbook build
gitbook serve >> /home/gitbook/serve.log 2>&1 &
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net
相关推荐: 【云原生 | Kubernetes 系列】—K8S部署RocketMQ集群(双主双从+同步模式)
【云原生 | Kubernetes 系列】—K8S部署RocketMQ集群(双主双从+同步模式) 版权 本文为云录原创文章,转载无需和我联系,但请注明来自云录 https://www.yunzhuan.site rocketMQ高可用有很多种方式,比如:单机部…