Centos7 set up GitBook environment

GitBook Environment###

To build a GitBook environment under Centos7, you need to install several components: nodejs, gitbook, git
Among them, nodejs can use nvm for version switching management.

Install nvm

nvm is an open source tool that can switch and manage the nodejs version, among which you can look at the warehouse on Github.
Visit nvm's github, as follows:

According to the introduction, you can see the related installation script as follows:

Execute installation script

Execute curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash as follows:

[ root@server01 ~]# curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
         Dload  Upload   Total   Spent    Left  Speed
100132261001322600238900:00:050:00:05- - :- - :- - 2959=> Downloading nvm from git to '/root/.nvm'=> Cloning into '/root/.nvm'...
remote: Enumerating objects:278, done.
remote: Counting objects:100%(278/278), done.
remote: Compressing objects:100%(249/249), done.
remote: Total 278(delta 33), reused 88(delta 16), pack-reused 0
Receiving objects:100%(278/278),142.36 KiB |132.00 KiB/s, done.
Resolving deltas:100%(33/33), done.=> Compressing and cleaning up git repository

=> Appending nvm source string to /root/.bashrc
=> Appending bash_completion source string to /root/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:export NVM_DIR="$HOME/.nvm"[-s "$NVM_DIR/nvm.sh"]&& \."$NVM_DIR/nvm.sh"  # This loads nvm
[- s "$NVM_DIR/bash_completion"]&& \."$NVM_DIR/bash_completion"  # This loads nvm bash_completion
[ root@server01 ~]# 

According to the prompt, you can see that the script has added the contents of the relevant environment variables to the /root/.bashrc file, let's take a look, as follows:

Set the environment variables to take effect

[ root@server01 ~]# source /root/.bashrc
[ root@server01 ~]# nvm -v

Node Version Manager

Note:<version> refers to any version-like string nvm understands. This includes:- full or partial version numbers, starting with an optional "v"(0.10, v0.1.2, v1)-default(built-in) aliases: node, stable, unstable, iojs, system
 - custom aliases you define with`nvm alias foo`

 Any options that produce colorized output should respect the `--no-colors` option.

Use nvm to install nodejs

Because the higher version of GitBook has the problem that the html in the sidebar cannot be redirected, it is necessary to install a lower version of nodejs to be compatible.
Execute nvm install 6.16.0 to install, execute nvm use 6.16.0 to switch to the version of nodejs.
Of course, you can also install other versions for switching.

[ root@server01 ~]# nvm install 6.16.0
Downloading and installing node v6.16.0...
Downloading https://nodejs.org/dist/v6.16.0/node-v6.16.0-linux-x64.tar.xz...
######################################################################## 100.0 %
Computing checksum with sha256sum
Checksums matched!
Now using node v6.16.0(npm v3.10.10)
Creating default alias:default->6.16.0(-> v6.16.0)[root@server01 ~]# 
[ root@server01 ~]# nvm use 6.16.0
Now using node v6.16.0(npm v3.10.10)[root@server01 ~]# 
[ root@server01 ~]# npm -v
3.10.10[ root@server01 ~]# node -v
v6.16.0[root@server01 ~]# 

Install Gitbook with npm

Execute npm install -g gitbook-cli to install Gitbook as follows:

Upload GitBook and start service display###

Create a new directory and upload the gitbook written under windows, as follows:

[ root@server01 redis_book]# ls
Chapter1  Chapter2  Chapter3  Chapter4  README.md  SUMMARY.md
[ root@server01 redis_book]# 

Start the preview service of GitBook as follows:

Since the system cannot recognize the Chinese path, the system language must be configured.

Configure the system default language of Centos7 to Chinese###

References: [Centos 7 Chinese language pack installation and Chinese support] (https://links.jianshu.com/go?to=https%3A%2F%2Fwww.centos.bz%2F2017%2F09%2Fcentos-7%25e4%25b8%25ad%25e6%2596%2587%25e8%25af%25ad%25e8%25a8%2580%25e5%258c%2585%25e7%259a%2584%25e5%25ae%2589%25e8%25a3%2585%25e5%258f%258a%25e4%25b8%25ad%25e6%2596%2587%25e6%2594%25af%25e6%258c%2581%2F)

View current system language

[ root@server01 redis_book]# echo $LANG
en_US.UTF-8[root@server01 redis_book]# 

Use locale to check if there is a Chinese font library

[ root@server01 redis_book]# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=[root@server01 redis_book]# 

It can be found that there is no Chinese font library.

Install Chinese font library

yum install kde-l10n-Chinese -y
yum reinstall glibc-common -y

Check the language pack again

Use locale -a to view the following:

Modify the configuration file etc/locale.conf

[ root@server01 ~]# cat /etc/locale.conf 
LANG="en_US.UTF-8"[root@server01 ~]# 
[ root@server01 ~]# vim /etc/locale.conf 
[ root@server01 ~]# 
[ root@server01 ~]# cat /etc/locale.conf 
LANG="zh_CN.UTF-8"[root@server01 ~]# 

After setting, use source /etc/locale.conf to reload the variables

[ root@server01 ~]# source /etc/locale.conf
[ root@server01 ~]# 
[ root@server01 ~]# locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=[root@server01 ~]# 

The final key operation is to upload the Gitbook Zip package in Windows first, and then decompress it in Centos, then the system can recognize

Finally, even if the system language is English utf-8, as long as the file is compressed and uploaded through the zip package, it can be used, and it is not necessary to set the system language to Chinese.

Finally, set nodejs background operation###

There are two ways, as follows:
gitbook serve &``setsid gitbook serve
Either way.

Recommended Posts

Centos7 set up GitBook environment
Centos6 set up GitBook environment
centos6.9 rabbitmq set up SSL
How to set up SSH keys on CentOS 8
CentOS 8 complete steps to set up automatic updates
Deploy GitBook under CentOS7
CentOS6.7 build LNMP environment
Hadoop environment construction (centos7)
Centos7.6 build LNMP environment
lamp (centos7) installation lamp environment
Centos6.9 install npm environment
Centos7 configure nodejs environment
Configure CentOS7 GPU environment
CentOS 7 build LNMP environment
Set up a CentOS network with Virtualbox on MacOS
[CentOS environment deployment] Java7/Java8 deployment under CentOS
Build docker environment under Centos6.5
How to set up an Apache virtual host on CentOS 7
CentOS 7 install JAVA environment (JDK 1.8)
SkyWalking study notes (CentOS environment)
CentOS 7.2 deploy Node.js development environment
CentOS install nginx+tomcat+java+mysql operating environment
How to set up a Masterless Puppet environment on Ubuntu 14.04
CentOS environment installation of Docker
Detailed steps to set up a Git server on CentOS
Centos7 deploys python3 virtual environment
Centos7.4 environment installation lamp-php7.0 tutorial
Set static IP under Centos
How to set up the Nginx server configuration block on CentOS 8
CentOS 7 configure Java language development environment
CentOS set ssh key login original
CentOS 7 configure Ruby language development environment
CentOS 7 configure php language development environment
CentOS7 compile and install L(A|N)MP environment
Build Nginx environment on Linux (CentOS)
Configure python3 environment on centos7 and
FFmpeg environment deployment record under centos7
CentOS6.8 Chinese/English environment switching tutorial illustration
CentOS 7 configure Python language development environment
PPTP environment deployment record under Centos
Tomcat configuration JMX in centos 6.5 environment