Skip to main content

Installation of Gitbook

Installation

sudo npm install -g gitbook-cli
gitbook -V

Then it will strat to install gitbook and output the version like this GitBook version: 3.2.3

Usage

In the beginning, we can use this to init the directory :

gitbook init

It will generate a file called as SUMMARY.md, and we can edit the every topic inside (Of course, we need to follow the format of gitbook). After that, we can use again gitbook init that it will follow each topic to create their directory (folder) automatically.

To deploy the gitbook :

gitbook serve

You can change the default port by this command. The default port is 4000, then suppose I wanna use 4001.

gitbook --port 4001 serve

For example:

$ gitbook --port 4001 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.2s !

Starting server ...
Serving book on http://localhost:4001

Then we can go to localhost:4001 to check it.

Plugin

Convert the ebook to other format

sudo apt-get install calibre

For emample:

Convert to PDF

gitbook pdf

Enable the gitpage feature on Gitlab

Reference: